summaryrefslogtreecommitdiff
path: root/update_daemon2.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-12-31 10:11:41 +0300
committerAndrew Dolgov <[email protected]>2020-12-31 10:11:41 +0300
commit2abc434e265278ff563db75368c0d50586fd4553 (patch)
treef551c576721851ea5a3ccc9225503df72d2f9132 /update_daemon2.php
parent8cc07bc8bda35308a4c784c266ad9227562647d5 (diff)
daemon: clarify some task-related messages
Diffstat (limited to 'update_daemon2.php')
-rwxr-xr-xupdate_daemon2.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/update_daemon2.php b/update_daemon2.php
index 300247a17..61cc85617 100755
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -58,12 +58,12 @@
if (file_is_locked("update_daemon-$pid.lock")) {
array_push($tmp, $pid);
} else {
- Debug::log("[reap_children] child $pid seems active but lockfile is unlocked.");
+ Debug::log("Child process with PID $pid seems active but lockfile is unlocked.");
unset($ctimes[$pid]);
}
} else {
- Debug::log("[reap_children] child $pid reaped.");
+ Debug::log("Child process with PID $pid reaped.");
unset($ctimes[$pid]);
}
}
@@ -80,7 +80,7 @@
$started = $ctimes[$pid];
if (time() - $started > MAX_CHILD_RUNTIME) {
- Debug::log("[MASTER] child process $pid seems to be stuck, aborting...");
+ Debug::log("Child process with PID $pid seems to be stuck, aborting...");
posix_kill($pid, SIGKILL);
}
}
@@ -92,7 +92,7 @@
function sigchld_handler($signal) {
$running_jobs = reap_children();
- Debug::log("[SIGCHLD] jobs left: $running_jobs");
+ Debug::log("Received SIGCHLD, $running_jobs active tasks left.");
pcntl_waitpid(-1, $status, WNOHANG);
}
@@ -100,7 +100,7 @@
function shutdown($caller_pid) {
if ($caller_pid == posix_getpid()) {
if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) {
- Debug::log("removing lockfile (master)...");
+ Debug::log("Removing lockfile (master)...");
unlink(LOCK_DIRECTORY . "/update_daemon.lock");
}
}
@@ -110,19 +110,19 @@
$pid = posix_getpid();
if (file_exists(LOCK_DIRECTORY . "/update_daemon-$pid.lock")) {
- Debug::log("removing lockfile ($pid)...");
+ Debug::log("Removing task lockfile for PID $pid...");
unlink(LOCK_DIRECTORY . "/update_daemon-$pid.lock");
}
}
function sigint_handler() {
- Debug::log("[MASTER] SIG_INT received.\n");
+ Debug::log("[MASTER] SIG_INT received, shutting down master process.");
shutdown(posix_getpid());
die;
}
function task_sigint_handler() {
- Debug::log("[TASK] SIG_INT received.\n");
+ Debug::log("[TASK] SIG_INT received, shutting down task.");
task_shutdown();
die;
}
@@ -215,7 +215,7 @@
if ($next_spawn % 60 == 0) {
$running_jobs = count($children);
- Debug::log("[MASTER] active jobs: $running_jobs, next spawn at $next_spawn sec.");
+ Debug::log("$running_jobs active tasks, next spawn at $next_spawn sec.");
}
if ($last_checkpoint + $spawn_interval < time()) {
@@ -229,14 +229,14 @@
} else if ($pid) {
if (!$master_handlers_installed) {
- Debug::log("[MASTER] installing shutdown handlers");
+ Debug::log("Installing shutdown handlers");
pcntl_signal(SIGINT, 'sigint_handler');
pcntl_signal(SIGTERM, 'sigint_handler');
register_shutdown_function('shutdown', posix_getpid());
$master_handlers_installed = true;
}
- Debug::log("[MASTER] spawned client $j [PID:$pid]...");
+ Debug::log("Spawned child process with PID $pid for task $j.");
array_push($children, $pid);
$ctimes[$pid] = time();
} else {