From 539bdbd30c38f7f391f1a0bedf39060e60c8b8bc Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 28 Mar 2020 00:56:11 +0100 Subject: [PATCH] Fix another bug in the Redis backend introduced in 7ff2288 --- db-redis.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db-redis.cpp b/db-redis.cpp index bd28b45..c23a3d0 100644 --- a/db-redis.cpp +++ b/db-redis.cpp @@ -130,6 +130,7 @@ void DBRedis::HMGET(const std::vector &positions, std::vector::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; @@ -161,9 +162,10 @@ void DBRedis::HMGET(const std::vector &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; } }