Browse code

db_redis: don't leave unconsumed redis replies in case of error on update

Execute db_redis_consume_replies on failed update same as in db_redis_insert:
if db_redis_perform_update encounters an error it was leaving unconsumed data
thus causing unexpected reply later on when reading from the same connection.

(cherry picked from commit bbd7b2ed5827252680e9d8949c193699da0a76b2)
(cherry picked from commit 7b371b77702471e62d8bd2ee957c44df73f1db80)

Andrii Pogrebennyk authored on 28/11/2021 07:34:36 • Daniel-Constantin Mierla committed on 06/12/2021 13:32:25
Showing 1 changed files
... ...
@@ -2249,6 +2249,7 @@ static int db_redis_perform_update(const db1_con_t* _h, km_redis_con_t *con, con
2249 2249
 
2250 2250
     db_redis_key_free(&all_type_keys);
2251 2251
     db_redis_key_free(&new_type_keys);
2252
+    db_redis_consume_replies(con);
2252 2253
     return 0;
2253 2254
 
2254 2255
 error:
... ...
@@ -2260,6 +2261,7 @@ error:
2260 2261
     db_redis_key_free(&type_keys);
2261 2262
     db_redis_key_free(&set_keys);
2262 2263
     db_redis_key_free(&new_type_keys);
2264
+    db_redis_consume_replies(con);
2263 2265
     return -1;
2264 2266
 }
2265 2267