Skip to content

Commit

Permalink
Fix another bug in the Redis backend
Browse files Browse the repository at this point in the history
introduced in 7ff2288
  • Loading branch information
sfan5 committed Mar 27, 2020
1 parent 48bf44c commit 539bdbd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db-redis.cpp
Expand Up @@ -130,6 +130,7 @@ void DBRedis::HMGET(const std::vector<BlockPos> &positions,

std::vector<BlockPos>::const_iterator position = positions.begin();
std::size_t remaining = positions.size();
std::size_t abs_i = 0;
while (remaining > 0) {
const std::size_t batch_size =
(remaining > DB_REDIS_HMGET_NUMFIELDS) ? DB_REDIS_HMGET_NUMFIELDS : remaining;
Expand Down Expand Up @@ -161,9 +162,10 @@ void DBRedis::HMGET(const std::vector<BlockPos> &positions,
REPLY_TYPE_ERR(subreply, "HMGET subreply");
if (subreply->len == 0)
throw std::runtime_error("HMGET empty string");
result(i, ustring((const unsigned char *) subreply->str, subreply->len));
result(abs_i + i, ustring((const unsigned char *) subreply->str, subreply->len));
}
freeReplyObject(reply);
abs_i += reply->elements;
remaining -= batch_size;
}
}
Expand Down

0 comments on commit 539bdbd

Please sign in to comment.