mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
Sentinel: PING trigger improved
It's ok to ping as soon as the ping period has elapsed since we received the last PONG, but it's not good that we ping again if there is a pending ping... With this change we'll send a new ping if there is one pending only if two times the ping period elapsed since the ping which is still pending was sent.
This commit is contained in:
parent
9d5e2ed392
commit
0eb0b55ff0
@ -2498,7 +2498,10 @@ void sentinelSendPeriodicCommands(sentinelRedisInstance *ri) {
|
||||
retval = redisAsyncCommand(ri->link->cc,
|
||||
sentinelInfoReplyCallback, ri, "INFO");
|
||||
if (retval == REDIS_OK) ri->link->pending_commands++;
|
||||
} else if ((now - ri->link->last_pong_time) > ping_period) {
|
||||
} else if ((now - ri->link->last_pong_time) > ping_period &&
|
||||
(ri->link->last_ping_time == 0 ||
|
||||
now - ri->link->last_ping_time > ping_period*2))
|
||||
{
|
||||
/* Send PING to all the three kinds of instances. */
|
||||
sentinelSendPing(ri);
|
||||
} else if ((now - ri->last_pub_time) > SENTINEL_PUBLISH_PERIOD) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user