[luad] move the #restarts check to the end of the loop, so that it does not get triggered when booting in the first 60secs of epoch time
This commit is contained in:
parent
91408ddac0
commit
b799e4629c
|
@ -339,13 +339,7 @@ int main(int argc, char *argv[])
|
||||||
struct restart_s restart;
|
struct restart_s restart;
|
||||||
restart_init(&restart);
|
restart_init(&restart);
|
||||||
|
|
||||||
while(1) {
|
do {
|
||||||
/* Stop when allowed number of restarts have occurred in specified time window */
|
|
||||||
if (restart_max(&restart)) {
|
|
||||||
daemon_log(LOG_ERR, "%d restarts within a %d sec window", SUP_ALLOWED_RESTARTS, SUP_MAX_SECONDS);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a new Lua environment */
|
/* Create a new Lua environment */
|
||||||
L = luaL_newstate();
|
L = luaL_newstate();
|
||||||
/* And load the standard libraries into the Lua environment */
|
/* And load the standard libraries into the Lua environment */
|
||||||
|
@ -356,10 +350,16 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
/* Clean up the Lua state */
|
/* Clean up the Lua state */
|
||||||
lua_close(L);
|
lua_close(L);
|
||||||
|
|
||||||
/* Wait for one second before restarting the Lua daemon */
|
/* Wait for one second before restarting the Lua daemon */
|
||||||
sleep(1);
|
|
||||||
restart_add(&restart, time(NULL));
|
restart_add(&restart, time(NULL));
|
||||||
}
|
sleep(1);
|
||||||
|
|
||||||
|
} while (!restart_max(&restart));
|
||||||
|
|
||||||
|
/* Stop when allowed number of restarts have occurred in specified time window */
|
||||||
|
daemon_log(LOG_ERR, "%d restarts within a %d sec window", SUP_ALLOWED_RESTARTS, SUP_MAX_SECONDS);
|
||||||
|
|
||||||
|
|
||||||
/* Do a cleanup */
|
/* Do a cleanup */
|
||||||
finish:
|
finish:
|
||||||
|
|
Loading…
Reference in New Issue