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

Function sentinelKillTimedoutScripts

src/sentinel.cpp:961–978  ·  view source on GitHub ↗

Kill scripts in timeout, they'll be collected by the * sentinelCollectTerminatedScripts() function. */

Source from the content-addressed store, hash-verified

959/* Kill scripts in timeout, they'll be collected by the
960 * sentinelCollectTerminatedScripts() function. */
961void sentinelKillTimedoutScripts(void) {
962 listNode *ln;
963 listIter li;
964 mstime_t now = mstime();
965
966 listRewind(sentinel.scripts_queue,&li);
967 while ((ln = listNext(&li)) != NULL) {
968 sentinelScriptJob *sj = (sentinelScriptJob*)ln->value;
969
970 if (sj->flags & SENTINEL_SCRIPT_RUNNING &&
971 (now - sj->start_time) > SENTINEL_SCRIPT_MAX_RUNTIME)
972 {
973 sentinelEvent(LL_WARNING,"-script-timeout",NULL,"%s %ld",
974 sj->argv[0], (long)sj->pid);
975 kill(sj->pid,SIGKILL);
976 }
977 }
978}
979
980/* Implements SENTINEL PENDING-SCRIPTS command. */
981void sentinelPendingScriptsCommand(client *c) {

Callers 1

sentinelTimerFunction · 0.85

Calls 4

listRewindFunction · 0.85
listNextFunction · 0.85
sentinelEventFunction · 0.85
mstimeFunction · 0.70

Tested by

no test coverage detected