From 3be2b18d9fb42e27ea0b444a5a1dd7b6e1d83330 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 6 Nov 2013 11:21:44 +0100 Subject: [PATCH] Sentinel: increment pending_commands counter in two more places. AUTH and SCRIPT KILL were sent without incrementing the pending commands counter. Clearly this needs some kind of wrapper doing it for the caller in order to be less bug prone. --- src/sentinel.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index 307a6071b..6bb407623 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -1298,9 +1298,10 @@ void sentinelSendAuthIfNeeded(sentinelRedisInstance *ri, redisAsyncContext *c) { char *auth_pass = (ri->flags & SRI_MASTER) ? ri->auth_pass : ri->master->auth_pass; - if (auth_pass) - redisAsyncCommand(c, sentinelDiscardReplyCallback, NULL, "AUTH %s", - auth_pass); + if (auth_pass) { + if (redisAsyncCommand(c, sentinelDiscardReplyCallback, NULL, "AUTH %s", + auth_pass) == REDIS_OK) ri->pending_commands++; + } } /* Create the async connections for the specified instance if the instance @@ -1689,8 +1690,10 @@ void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata (ri->flags & SRI_S_DOWN) && !(ri->flags & SRI_SCRIPT_KILL_SENT)) { - redisAsyncCommand(ri->cc, - sentinelDiscardReplyCallback, NULL, "SCRIPT KILL"); + if (redisAsyncCommand(ri->cc, + sentinelDiscardReplyCallback, NULL, + "SCRIPT KILL") == REDIS_OK) + ri->pending_commands++; ri->flags |= SRI_SCRIPT_KILL_SENT; } }