]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
update_daemon2: print idle notice once per 10 seconds
[tt-rss.git] / functions.php
index a5da7b0bba3ad0b26dcc5cee2d46559d72b13b62..099da8a41bcc3bae78fc53366cd7ed19174fe29f 100644 (file)
@@ -77,6 +77,7 @@
 
        function _debug($msg) {
                $ts = strftime("%H:%M:%S", time());
+               $ts = "$ts/" . posix_getpid();
                print "[$ts] $msg\n";
        }
 
                        _debug("update_rss_feed: start");
                }
 
-               $result = db_query($link, "SELECT id,update_interval,auth_login,auth_pass,cache_images
-                       FROM ttrss_feeds WHERE id = '$feed'");
+               if (DB_TYPE == "pgsql") {
+                               $updstart_thresh_qpart = "(ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '120 seconds')";
+                       } else {
+                               $updstart_thresh_qpart = "(ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 120 SECOND))";
+                       }                       
+
+               $result = db_query($link, "SELECT id,update_interval,auth_login,
+                       auth_pass,cache_images
+                       FROM ttrss_feeds WHERE id = '$feed' AND $updstart_thresh_qpart");
 
                if (db_num_rows($result) == 0) {
                        if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
-                               _debug("update_rss_feed: feed $feed [$feed_url] NOT FOUND");
+                               _debug("update_rss_feed: feed $feed [$feed_url] NOT FOUND/SKIPPED");
                        }               
                        return;
                }
 
+               db_query($link, "UPDATE ttrss_feeds SET last_update_started = NOW()
+                       WHERE id = '$feed'");
+
                $auth_login = db_fetch_result($result, 0, "auth_login");
                $auth_pass = db_fetch_result($result, 0, "auth_pass");
 
                print "<param key=\"icons_location\" value=\"" . 
                        ICONS_URL . "\"/>";
 
+               print "<param key=\"hide_read_shows_special\" value=\"" . 
+                       (int) get_pref($link, "HIDE_READ_SHOWS_SPECIAL") . "\"/>";
+
                print "</init-params>";
        }