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

Function sentinelScriptRetryDelay

src/sentinel.cpp:903–908  ·  view source on GitHub ↗

How much to delay the execution of a script that we need to retry after * an error? * * We double the retry delay for every further retry we do. So for instance * if RETRY_DELAY is set to 30 seconds and the max number of retries is 10 * starting from the second attempt to execute the script the delays are: * 30 sec, 60 sec, 2 min, 4 min, 8 min, 16 min, 32 min, 64 min, 128 min. */

Source from the content-addressed store, hash-verified

901 * starting from the second attempt to execute the script the delays are:
902 * 30 sec, 60 sec, 2 min, 4 min, 8 min, 16 min, 32 min, 64 min, 128 min. */
903mstime_t sentinelScriptRetryDelay(int retry_num) {
904 mstime_t delay = SENTINEL_SCRIPT_RETRY_DELAY;
905
906 while (retry_num-- > 1) delay *= 2;
907 return delay;
908}
909
910/* Check for scripts that terminated, and remove them from the queue if the
911 * script terminated successfully. If instead the script was terminated by

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected