more brutal heartbeat emperor management

This commit is contained in:
Unbit
2013-09-18 12:03:35 +02:00
parent dd8fd8f19c
commit cbf9ccf062
+6 -2
View File
@@ -1521,10 +1521,14 @@ void emperor_loop() {
while (ui_current) {
if (ui_current->last_heartbeat > 0) {
if ((ui_current->last_heartbeat + uwsgi.emperor_heartbeat) < uwsgi_now()) {
uwsgi_log("[emperor] vassal %s sent no heartbeat in last %d seconds, respawning it...\n", ui_current->name, uwsgi.emperor_heartbeat);
uwsgi_log("[emperor] vassal %s sent no heartbeat in last %d seconds, brutally respawning it...\n", ui_current->name, uwsgi.emperor_heartbeat);
// set last_heartbeat to 0 avoiding races
ui_current->last_heartbeat = 0;
emperor_respawn(ui_current, uwsgi_now());
if (ui_current->pid > 0) {
if (kill(ui_current->pid, SIGKILL)) {
uwsgi_error("[emperor] kill()");
}
}
}
}
ui_current = ui_current->ui_next;