diff options
author | antirez <antirez@gmail.com> | 2012-07-24 18:57:26 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2012-09-27 13:04:24 +0200 |
commit | 2085fdb1f4076ed29c04f546305b04ba6f2d8a77 (patch) | |
tree | eba67a44d36b5efddb9d0b660c24d50b86a75894 | |
parent | f8a19e32e2fffea00e61717d99ecebabafbbe852 (diff) | |
download | redis-2085fdb1f4076ed29c04f546305b04ba6f2d8a77.tar.gz |
Sentinel: reset pending_commands in a more generic way.
-rw-r--r-- | src/sentinel.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index e89b343a9..8ec5d151b 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -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; |