diff options
author | Andrew Dolgov <[email protected]> | 2007-03-15 16:45:42 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-03-15 16:45:42 +0100 |
commit | 4052b32d16238a2060cec078c0e566c95848c697 (patch) | |
tree | 3072086f89c9f72583b48575661de3a6e39bc7bb | |
parent | 219bd8fcfcd91922aedba01a676dbd4068fbc803 (diff) |
add rudimentary hang-check based on pcntl_alarm
-rw-r--r-- | update_daemon.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/update_daemon.php b/update_daemon.php index f99e4f763..b42d7d214 100644 --- a/update_daemon.php +++ b/update_daemon.php @@ -32,7 +32,12 @@ die("Received SIGINT. Exiting.\n"); } + function sigalrm_handler() { + die("received SIGALRM, hang in feed update?\n"); + } + pcntl_signal(SIGINT, sigint_handler); + pcntl_signal(SIGALRM, sigalrm_handler); $lock_handle = make_lockfile("update_daemon.lock"); @@ -146,7 +151,16 @@ _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); + + pcntl_alarm(0); + sleep(1); // prevent flood (FIXME make this an option?) } else { _debug("Update not needed."); |