Skip to content

Commit

Permalink
redis: throw error if block request failed
Browse files Browse the repository at this point in the history
Fixes #3196. Before, we didn't throw an error, and the engine thought the
block isn't occupied. But in fact it might be that redis is still loading,
and the block does exist in the database. The result was a cheesy map.
  • Loading branch information
netinetwalker authored and est31 committed Sep 26, 2015
1 parent f062bbd commit 524a765
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/database-redis.cpp
Expand Up @@ -118,12 +118,21 @@ std::string Database_Redis::loadBlock(const v3s16 &pos)
freeReplyObject(reply);
return str;
}
case REDIS_REPLY_ERROR:
errorstream << "WARNING: loadBlock: loading block " << PP(pos)
<< " failed: " << reply->str << std::endl;
case REDIS_REPLY_ERROR: {
std::string errstr = reply->str;
freeReplyObject(reply);
errorstream << "loadBlock: loading block " << PP(pos)
<< " failed: " << errstr << std::endl;
throw FileNotGoodException(std::string(
"Redis command 'HGET %s %s' errored: ") + errstr);
}
}
errorstream << "loadBlock: loading block " << PP(pos)
<< " returned invalid reply type " << reply->type
<< ": " << reply->str << std::endl;
freeReplyObject(reply);
return "";
throw FileNotGoodException(std::string(
"Redis command 'HGET %s %s' gave invalid reply."));
}

bool Database_Redis::deleteBlock(const v3s16 &pos)
Expand Down

0 comments on commit 524a765

Please sign in to comment.