]> git.wh0rd.org - tt-rss.git/blobdiff - update_daemon2_client.php
update_daemon2: don't expect client part to be executable
[tt-rss.git] / update_daemon2_client.php
index 2d069c37d87b7386065479ef9602348fcd2aeb5d..8934cbe497b0750530d5256fc6ed1749e00ea1be 100644 (file)
@@ -3,6 +3,8 @@
        // define('DEFAULT_ERROR_LEVEL', E_ALL);
        define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
 
+       $start_timestamp = time();
+
        if ($argv[1] != "SRV_RUN_OK") {
                die("This script should be started by update_daemon2.php.\n");
        }
 
        $last_purge = 0;
 
-//     if (!make_stampfile('update_daemon.stamp')) {
-//             print "error: unable to create stampfile";
-//             die;
-//     }
+       if (!make_stampfile('update_daemon.stamp')) {
+               print "warning: unable to create stampfile";
+       }
 
        if (time() - $last_purge > PURGE_INTERVAL) {
                _debug("Purging old posts (random 30 feeds)...");
@@ -95,9 +96,9 @@
        }
 
        if (DB_TYPE == "pgsql") {
-                       $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started >= NOW() - INTERVAL '120 seconds')";
+                       $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '120 seconds')";
                } else {
-                       $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started >= DATE_SUB(NOW(), INTERVAL 120 SECOND))";
+                       $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 120 SECOND))";
                }                       
 
        $result = db_query($link, "SELECT feed_url,ttrss_feeds.id,owner_uid,
 
        if (DAEMON_SENDS_DIGESTS) send_headlines_digests($link);
 
+       print "Elapsed time: " . (time() - $start_timestamp) . " second(s)\n";
+
        db_close($link);
 ?>