add rudimentary hang-check based on pcntl_alarm

This commit is contained in:
Andrew Dolgov 2007-03-15 16:45:42 +01:00
parent 219bd8fcfc
commit 4052b32d16
1 changed files with 14 additions and 0 deletions

View File

@ -32,7 +32,12 @@
die("Received SIGINT. Exiting.\n"); die("Received SIGINT. Exiting.\n");
} }
function sigalrm_handler() {
die("received SIGALRM, hang in feed update?\n");
}
pcntl_signal(SIGINT, sigint_handler); pcntl_signal(SIGINT, sigint_handler);
pcntl_signal(SIGALRM, sigalrm_handler);
$lock_handle = make_lockfile("update_daemon.lock"); $lock_handle = make_lockfile("update_daemon.lock");
@ -146,7 +151,16 @@
_debug("Updating..."); _debug("Updating...");
if (defined('MAGPIE_FETCH_TIME_OUT')) {
pcntl_alarm(MAGPIE_FETCH_TIME_OUT * 2);
} else {
pcntl_alarm(300);
}
update_rss_feed($link, $line["feed_url"], $line["id"], true); update_rss_feed($link, $line["feed_url"], $line["id"], true);
pcntl_alarm(0);
sleep(1); // prevent flood (FIXME make this an option?) sleep(1); // prevent flood (FIXME make this an option?)
} else { } else {
_debug("Update not needed."); _debug("Update not needed.");