]> git.saurik.com Git - redis.git/commitdiff
Sentinel: reset pending_commands in a more generic way.
authorantirez <antirez@gmail.com>
Tue, 24 Jul 2012 16:57:26 +0000 (18:57 +0200)
committerantirez <antirez@gmail.com>
Thu, 27 Sep 2012 11:04:24 +0000 (13:04 +0200)
src/sentinel.c

index e89b343a93919292a9fc9249b40954ef1f67bb49..8ec5d151b99f6e14388b2d3e918aee5dc2d3dd6b 100644 (file)
@@ -765,7 +765,6 @@ void sentinelResetMaster(sentinelRedisInstance *ri, int flags) {
     ri->sentinels = dictCreate(&instancesDictType,NULL);
     if (ri->cc) sentinelKillLink(ri,ri->cc);
     if (ri->pc) sentinelKillLink(ri,ri->pc);
-    ri->pending_commands = 0;
     ri->flags &= SRI_MASTER|SRI_CAN_FAILOVER|SRI_DISCONNECTED;
     if (ri->leader) {
         sdsfree(ri->leader);
@@ -891,7 +890,10 @@ char *sentinelHandleConfiguration(char **argv, int argc) {
 
 /* Completely disconnect an hiredis link from an instance. */
 void sentinelKillLink(sentinelRedisInstance *ri, redisAsyncContext *c) {
-    if (ri->cc == c) ri->cc = NULL;
+    if (ri->cc == c) {
+        ri->cc = NULL;
+        ri->pending_commands = 0;
+    }
     if (ri->pc == c) ri->pc = NULL;
     c->data = NULL;
     ri->flags |= SRI_DISCONNECTED;