[sr-dev] git:master:bbd7b2ed: db_redis: don't leave unconsumed redis replies in case of error on update

Andrii Pogrebennyk andrii at ng-voice.com
Tue Nov 30 11:03:12 CET 2021


Module: kamailio
Branch: master
Commit: bbd7b2ed5827252680e9d8949c193699da0a76b2
URL: https://github.com/kamailio/kamailio/commit/bbd7b2ed5827252680e9d8949c193699da0a76b2

Author: Andrii Pogrebennyk <andrii at ng-voice.com>
Committer: Andrii Pogrebennyk <andrii at ng-voice.com>
Date: 2021-11-28T08:34:36+01:00

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.

---

Modified: src/modules/db_redis/redis_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/bbd7b2ed5827252680e9d8949c193699da0a76b2.diff
Patch: https://github.com/kamailio/kamailio/commit/bbd7b2ed5827252680e9d8949c193699da0a76b2.patch

---

diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index f7e26e693e..a53d1a3443 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -2249,6 +2249,7 @@ static int db_redis_perform_update(const db1_con_t* _h, km_redis_con_t *con, con
 
     db_redis_key_free(&all_type_keys);
     db_redis_key_free(&new_type_keys);
+    db_redis_consume_replies(con);
     return 0;
 
 error:
@@ -2260,6 +2261,7 @@ static int db_redis_perform_update(const db1_con_t* _h, km_redis_con_t *con, con
     db_redis_key_free(&type_keys);
     db_redis_key_free(&set_keys);
     db_redis_key_free(&new_type_keys);
+    db_redis_consume_replies(con);
     return -1;
 }
 




More information about the sr-dev mailing list