]> git.wh0rd.org - tt-rss.git/commitdiff
purge improvements in daemon
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 27 Feb 2006 08:40:53 +0000 (09:40 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 27 Feb 2006 08:40:53 +0000 (09:40 +0100)
update_daemon.php

index 8eca25b5996058932f143524cdfa20fb504aa167..da94050fc31ea7f23b064ee0d94ef64e009b7cf2 100644 (file)
@@ -8,6 +8,8 @@
        define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-daemon');
        define('DISABLE_SESSIONS', true);
 
+       define('PURGE_INTERVAL', 3600); // seconds
+
        require_once "sanity_check.php";
        require_once "config.php";
 
                pg_query("set client_encoding = 'utf-8'");
        }
 
+       $last_purge = 0;
+
        while (true) {
-               
-               print "Purging old posts...\n";
 
-               global_purge_old_posts($link, false);
+               if (time() - $last_purge > PURGE_INTERVAL) {
+                       print "Purging old posts...\n";
+                       global_purge_old_posts($link, true);
+                       $last_purge = time();
+               }
 
                // FIXME: get all scheduled updates w/forced refetch
                // Stub, until I figure out if it is really needed.