]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix updating for pgsql
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 24 Apr 2013 09:43:40 +0000 (13:43 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 24 Apr 2013 09:43:40 +0000 (13:43 +0400)
increase default batch size
remove random check between feedbrowser or update task executing

include/rssfuncs.php
update.php

index e9b9c71422f0649375c1fdf5916de4d3a5a5d781..ac00a9408f4d8e49f531fe1868c343bb12fb4d66 100644 (file)
@@ -1,7 +1,7 @@
 <?php
-       define('DAEMON_UPDATE_LOGIN_LIMIT', 30);
-       define('DAEMON_FEED_LIMIT', 100);
-       define('DAEMON_SLEEP_INTERVAL', 60);
+       define_default('DAEMON_UPDATE_LOGIN_LIMIT', 30);
+       define_default('DAEMON_FEED_LIMIT', 500);
+       define_default('DAEMON_SLEEP_INTERVAL', 60);
 
        function update_feedbrowser_cache() {
 
                $query_limit = "";
                if($limit) $query_limit = sprintf("LIMIT %d", $limit);
 
-               // We search for feed needing update.
-               $result = db_query("SELECT DISTINCT ttrss_feeds.feed_url
+               $query = "SELECT DISTINCT ttrss_feeds.feed_url, ttrss_feeds.last_updated
                        FROM
                                ttrss_feeds, ttrss_users, ttrss_user_prefs
                        WHERE
                                AND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'
                                $login_thresh_qpart $update_limit_qpart
                                $updstart_thresh_qpart
-                       ORDER BY last_updated $query_limit");
+                               ORDER BY last_updated $query_limit";
+
+               // We search for feed needing update.
+               $result = db_query($query);
 
                if($debug) _debug(sprintf("Scheduled %d feeds to update...", db_num_rows($result)));
 
index c301083f931e3c22f0f64ab5d13adee0ebfd79dd..ce354bbae62c7680c54d1638b11f08e22784185b 100755 (executable)
                        _debug("warning: unable to create stampfile\n");
                }
 
-               // Call to the feed batch update function
-               // or regenerate feedbrowser cache
-
-               if (rand(0,100) > 30) {
-                       update_daemon_common();
-               } else {
-                       $count = update_feedbrowser_cache();
-                       _debug("Feedbrowser updated, $count feeds processed.");
-
-                       purge_orphans( true);
+               update_daemon_common();
 
-                       $rc = cleanup_tags( 14, 50000);
+               $count = update_feedbrowser_cache();
+               _debug("Feedbrowser updated, $count feeds processed.");
 
-                       _debug("Cleaned $rc cached tags.");
+               purge_orphans( true);
 
-                       PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
-               }
+               $rc = cleanup_tags( 14, 50000);
 
+               _debug("Cleaned $rc cached tags.");
+               PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
        }
 
        if (isset($options["cleanup-tags"])) {