<?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', 120);
function update_feedbrowser_cache() {
// Test if feed is currently being updated by another process.
if (DB_TYPE == "pgsql") {
- $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '5 minutes')";
+ $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '10 minutes')";
} else {
- $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 5 MINUTE))";
+ $updstart_thresh_qpart = "AND (ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 10 MINUTE))";
}
// Test if there is a limit to number of updated feeds
$query_limit = "";
if($limit) $query_limit = sprintf("LIMIT %d", $limit);
- $random_qpart = sql_random_function();
-
- // We search for feed needing update.
- $result = db_query("SELECT DISTINCT ttrss_feeds.feed_url,$random_qpart
+ $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 $random_qpart $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)));
WHERE feed_url IN (%s)", implode(',', $feeds_quoted)));
}
- expire_cached_files($debug);
- expire_lock_files($debug);
- expire_error_log($debug);
-
$nf = 0;
// For each feed, we call the feed update function.
_debug("local cache valid and older than last_updated, nothing to do.", $debug_enabled);
return;
}
+ } else {
+ _debug("local cache will not be used for this feed", $debug_enabled);
+ $cache_timestamp = 0;
}
if (!$rss) {
}
function expire_lock_files($debug) {
- if ($debug) _debug("Removing old lock files...");
+ //if ($debug) _debug("Removing old lock files...");
$num_deleted = 0;
}
}
- if ($debug) _debug("Removed $num_deleted files.");
+ if ($debug) _debug("Removed $num_deleted old lock files.");
}
function expire_cached_files($debug) {
foreach (array("simplepie", "images", "export", "upload") as $dir) {
$cache_dir = CACHE_DIR . "/$dir";
- if ($debug) _debug("Expiring $cache_dir");
+// if ($debug) _debug("Expiring $cache_dir");
$num_deleted = 0;
}
}
- if ($debug) _debug("Removed $num_deleted files.");
+ if ($debug) _debug("$cache_dir: removed $num_deleted files.");
}
}
return $error;
}
+ function housekeeping_common($debug) {
+ expire_cached_files($debug);
+ expire_lock_files($debug);
+ expire_error_log($debug);
+
+ $count = update_feedbrowser_cache();
+ _debug("Feedbrowser updated, $count feeds processed.");
+
+ purge_orphans( true);
+ $rc = cleanup_tags( 14, 50000);
+
+ _debug("Cleaned $rc cached tags.");
+ }
?>