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

Function sentinelHandleRedisInstance

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

Perform scheduled operations for the specified Redis instance. */

Source from the content-addressed store, hash-verified

5005
5006/* Perform scheduled operations for the specified Redis instance. */
5007void sentinelHandleRedisInstance(sentinelRedisInstance *ri) {
5008 /* ========== MONITORING HALF ============ */
5009 /* Every kind of instance */
5010 sentinelReconnectInstance(ri);
5011 sentinelSendPeriodicCommands(ri);
5012
5013 /* ============== ACTING HALF ============= */
5014 /* We don't proceed with the acting half if we are in TILT mode.
5015 * TILT happens when we find something odd with the time, like a
5016 * sudden change in the clock. */
5017 if (sentinel.tilt) {
5018 if (mstime()-sentinel.tilt_start_time < SENTINEL_TILT_PERIOD) return;
5019 sentinel.tilt = 0;
5020 sentinelEvent(LL_WARNING,"-tilt",NULL,"#tilt mode exited");
5021 }
5022
5023 /* Every kind of instance */
5024 sentinelCheckSubjectivelyDown(ri);
5025
5026 /* Masters and slaves */
5027 if (ri->flags & (SRI_MASTER|SRI_SLAVE)) {
5028 /* Nothing so far. */
5029 }
5030
5031 /* Only masters */
5032 if (ri->flags & SRI_MASTER) {
5033 sentinelCheckObjectivelyDown(ri);
5034 if (sentinelStartFailoverIfNeeded(ri))
5035 sentinelAskMasterStateToOtherSentinels(ri,SENTINEL_ASK_FORCED);
5036 sentinelFailoverStateMachine(ri);
5037 sentinelAskMasterStateToOtherSentinels(ri,SENTINEL_NO_FLAGS);
5038 }
5039}
5040
5041/* Perform scheduled operations for all the instances in the dictionary.
5042 * Recursively call the function against dictionaries of slaves. */

Callers 1

Calls 9

sentinelEventFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected