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

Function sentinelTimer

src/sentinel.cpp:5113–5127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5111}
5112
5113void sentinelTimer(void) {
5114 sentinelCheckTiltCondition();
5115 sentinelHandleDictOfRedisInstances(sentinel.masters);
5116 sentinelRunPendingScripts();
5117 sentinelCollectTerminatedScripts();
5118 sentinelKillTimedoutScripts();
5119
5120 /* We continuously change the frequency of the Redis "timer interrupt"
5121 * in order to desynchronize every Sentinel from every other.
5122 * This non-determinism avoids that Sentinels started at the same time
5123 * exactly continue to stay synchronized asking to be voted at the
5124 * same time again and again (resulting in nobody likely winning the
5125 * election because of split brain voting). */
5126 g_pserver->hz = CONFIG_DEFAULT_HZ + rand() % CONFIG_DEFAULT_HZ;
5127}

Callers 1

serverCronFunction · 0.85

Tested by

no test coverage detected