]> git.saurik.com Git - redis.git/blobdiff - src/sentinel.c
Prevent a spurious +sdown event on switch.
[redis.git] / src / sentinel.c
index 3acadf831f26ab2bb6130d1d9b2421d4da825358..e89b343a93919292a9fc9249b40954ef1f67bb49 100644 (file)
@@ -765,6 +765,7 @@ 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);
@@ -778,6 +779,8 @@ void sentinelResetMaster(sentinelRedisInstance *ri, int flags) {
     sdsfree(ri->slave_master_host);
     ri->runid = NULL;
     ri->slave_master_host = NULL;
+    ri->last_avail_time = mstime();
+    ri->last_pong_time = mstime();
     if (flags & SENTINEL_GENERATE_EVENT)
         sentinelEvent(REDIS_WARNING,"+reset-master",ri,"%@");
 }