new option: MAX_UPDATE_TIME
This commit is contained in:
parent
e2cb4c6d7a
commit
cbd8650dfe
|
@ -74,5 +74,14 @@
|
||||||
define('FEEDS_FRAME_REFRESH', 600);
|
define('FEEDS_FRAME_REFRESH', 600);
|
||||||
// Auto refresh interval for feeds frame (in seconds)
|
// Auto refresh interval for feeds frame (in seconds)
|
||||||
|
|
||||||
|
define('MAX_UPDATE_TIME', 0);
|
||||||
|
// Limit one update sequence run to this number of seconds.
|
||||||
|
// The valiue is not exact, because it is being checked between feed updates,
|
||||||
|
// which could use abritrary amount of time. Feeds which could not be updated
|
||||||
|
// in time, are being skipped.
|
||||||
|
// If this option is enabled (non-zero) feeds are updated in random order.
|
||||||
|
// It is also recommended to set FEEDS_FRAME_REFRESH to a lower value if using
|
||||||
|
// this option.
|
||||||
|
|
||||||
// vim:ft=php
|
// vim:ft=php
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -101,10 +101,22 @@
|
||||||
|
|
||||||
// db_query($link, "BEGIN");
|
// db_query($link, "BEGIN");
|
||||||
|
|
||||||
|
if (MAX_UPDATE_TIME > 0) {
|
||||||
|
if (DB_TYPE == "mysql") {
|
||||||
|
$q_order = "RAND()";
|
||||||
|
} else {
|
||||||
|
$q_order = "RANDOM()";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$q_order = "last_updated DESC";
|
||||||
|
}
|
||||||
|
|
||||||
$result = db_query($link, "SELECT feed_url,id,
|
$result = db_query($link, "SELECT feed_url,id,
|
||||||
SUBSTRING(last_updated,1,19) AS last_updated,
|
SUBSTRING(last_updated,1,19) AS last_updated,
|
||||||
update_interval FROM ttrss_feeds WHERE owner_uid = '$user_id'
|
update_interval FROM ttrss_feeds WHERE owner_uid = '$user_id'
|
||||||
ORDER BY last_updated DESC");
|
ORDER BY $q_order");
|
||||||
|
|
||||||
|
$upd_start = time();
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
$upd_intl = $line["update_interval"];
|
$upd_intl = $line["update_interval"];
|
||||||
|
@ -116,7 +128,15 @@
|
||||||
if ($fetch || (!$line["last_updated"] ||
|
if ($fetch || (!$line["last_updated"] ||
|
||||||
time() - strtotime($line["last_updated"]) > ($upd_intl * 60))) {
|
time() - strtotime($line["last_updated"]) > ($upd_intl * 60))) {
|
||||||
|
|
||||||
|
// print "<!-- feed: ".$line["feed_url"]." -->";
|
||||||
|
|
||||||
update_rss_feed($link, $line["feed_url"], $line["id"], $force_daemon);
|
update_rss_feed($link, $line["feed_url"], $line["id"], $force_daemon);
|
||||||
|
|
||||||
|
$upd_elapsed = time() - $upd_start;
|
||||||
|
|
||||||
|
if (MAX_UPDATE_TIME > 0 && $upd_elapsed > MAX_UPDATE_TIME) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue