]> git.wh0rd.org - tt-rss.git/commitdiff
add rudimentary hang-check based on pcntl_alarm (2)
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 15 Mar 2007 15:55:49 +0000 (16:55 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 15 Mar 2007 15:55:49 +0000 (16:55 +0100)
update_daemon.php

index 37c04e28fe06ec920afcde5f3e594834a06394e1..ca60b2a3aa4d82c3740c0b90ed0f51b85fac4039 100644 (file)
                die("Received SIGINT. Exiting.\n");
        }
 
-//     function sigalrm_handler() {
-//             print "SIGALARM\n";
-//             pcntl_alarm(3);
-//     }
+       function sigalrm_handler() {
+               die("received SIGALRM, hang in feed update?\n");
+       }
 
        pcntl_signal(SIGINT, sigint_handler);
-//     pcntl_signal(SIGALRM, sigalrm_handler);
+       pcntl_signal(SIGALRM, sigalrm_handler);
 
        $lock_handle = make_lockfile("update_daemon.lock");
 
 
                                _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.");