Send a PING to the specified instance and refresh the act_ping_time * if it is zero (that is, if we received a pong for the previous ping). * * On error zero is returned, and we can't consider the PING command * queued in the connection. */
| 3079 | * On error zero is returned, and we can't consider the PING command |
| 3080 | * queued in the connection. */ |
| 3081 | int sentinelSendPing(sentinelRedisInstance *ri) { |
| 3082 | int retval = redisAsyncCommand(ri->link->cc, |
| 3083 | sentinelPingReplyCallback, ri, "%s", |
| 3084 | sentinelInstanceMapCommand(ri,"PING")); |
| 3085 | if (retval == C_OK) { |
| 3086 | ri->link->pending_commands++; |
| 3087 | ri->link->last_ping_time = mstime(); |
| 3088 | /* We update the active ping time only if we received the pong for |
| 3089 | * the previous ping, otherwise we are technically waiting since the |
| 3090 | * first ping that did not receive a reply. */ |
| 3091 | if (ri->link->act_ping_time == 0) |
| 3092 | ri->link->act_ping_time = ri->link->last_ping_time; |
| 3093 | return 1; |
| 3094 | } else { |
| 3095 | return 0; |
| 3096 | } |
| 3097 | } |
| 3098 | |
| 3099 | /* Send periodic PING, INFO, and PUBLISH to the Hello channel to |
| 3100 | * the specified master or slave instance. */ |
no test coverage detected