Skip to content

Commit

Permalink
Sentinel: reset pending_commands in a more generic way.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Jul 24, 2012
1 parent a23a5b6 commit 9e5bef3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/sentinel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9e5bef3

Please sign in to comment.