summaryrefslogtreecommitdiff
path: root/update_daemon.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-03-21 05:52:56 +0100
committerAndrew Dolgov <[email protected]>2006-03-21 05:52:56 +0100
commit44e241cb44eb2c309b6def732d828368a7486824 (patch)
tree97fa784cdf86c13e737e0f76667f693a0bf7bc01 /update_daemon.php
parent03f321db5741ce20dc484629b42908463ce6f284 (diff)
query optimizations; split big feed update transaction
Diffstat (limited to 'update_daemon.php')
-rw-r--r--update_daemon.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/update_daemon.php b/update_daemon.php
index da94050fc..cf51bdd3a 100644
--- a/update_daemon.php
+++ b/update_daemon.php
@@ -74,14 +74,21 @@
$result = db_query($link, "SELECT feed_url,id,owner_uid,
SUBSTRING(last_updated,1,19) AS last_updated,
update_interval FROM ttrss_feeds ORDER BY last_updated DESC");
-
+
+ $user_prefs_cache = array();
+
while ($line = db_fetch_assoc($result)) {
$upd_intl = $line["update_interval"];
$user_id = $line["owner_uid"];
if (!$upd_intl || $upd_intl == 0) {
- $upd_intl = get_pref($link, 'DEFAULT_UPDATE_INTERVAL', $user_id);
+ if (!$user_prefs_cache[$user_id]['DEFAULT_UPDATE_INTERVAL']) {
+ $upd_intl = get_pref($link, 'DEFAULT_UPDATE_INTERVAL', $user_id);
+ $user_prefs_cache[$user_id]['DEFAULT_UPDATE_INTERVAL'] = $upd_intl;
+ } else {
+ $upd_intl = $user_prefs_cache[$user_id]['DEFAULT_UPDATE_INTERVAL'];
+ }
}
if ($upd_intl < 0) {
@@ -99,7 +106,7 @@
print "Updating...\n";
update_rss_feed($link, $line["feed_url"], $line["id"], true);
- sleep(3); // prevent flood (FIXME make this an option?)
+ sleep(1); // prevent flood (FIXME make this an option?)
} else {
print "Update not needed.\n";
}