MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sentinelSendPing

Function sentinelSendPing

app/redis-6.2.6/src/sentinel.c:3069–3085  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

3067 * On error zero is returned, and we can't consider the PING command
3068 * queued in the connection. */
3069int sentinelSendPing(sentinelRedisInstance *ri) {
3070 int retval = redisAsyncCommand(ri->link->cc,
3071 sentinelPingReplyCallback, ri, "%s",
3072 sentinelInstanceMapCommand(ri,"PING"));
3073 if (retval == C_OK) {
3074 ri->link->pending_commands++;
3075 ri->link->last_ping_time = mstime();
3076 /* We update the active ping time only if we received the pong for
3077 * the previous ping, otherwise we are technically waiting since the
3078 * first ping that did not receive a reply. */
3079 if (ri->link->act_ping_time == 0)
3080 ri->link->act_ping_time = ri->link->last_ping_time;
3081 return 1;
3082 } else {
3083 return 0;
3084 }
3085}
3086
3087/* Send periodic PING, INFO, and PUBLISH to the Hello channel to
3088 * the specified master or slave instance. */

Callers 2

Calls 3

redisAsyncCommandFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected