MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sentinelSendPing

Function sentinelSendPing

src/sentinel.cpp:3081–3097  ·  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

3079 * On error zero is returned, and we can't consider the PING command
3080 * queued in the connection. */
3081int 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. */

Callers 2

Calls 3

redisAsyncCommandFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected