From 2085fdb1f4076ed29c04f546305b04ba6f2d8a77 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 24 Jul 2012 18:57:26 +0200 Subject: [PATCH] Sentinel: reset pending_commands in a more generic way. --- src/sentinel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index e89b343a..8ec5d151 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; -- 2.47.2