mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 12:35:56 +00:00
make globalUpdateFeeds handler use simple update mechanism to prevent script timeouts
This commit is contained in:
@@ -391,13 +391,9 @@ class Handler_Public extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function globalUpdateFeeds() {
|
function globalUpdateFeeds() {
|
||||||
include "rssfuncs.php";
|
RPC::updaterandomfeed_real($this->dbh);
|
||||||
// Update all feeds needing a update.
|
|
||||||
update_daemon_common(0, true, false);
|
|
||||||
housekeeping_common(false);
|
|
||||||
|
|
||||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
|
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sharepopup() {
|
function sharepopup() {
|
||||||
|
|||||||
@@ -476,7 +476,8 @@ class RPC extends Handler_Protected {
|
|||||||
print json_encode(array("wide" => $wide));
|
print json_encode(array("wide" => $wide));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updaterandomfeed() {
|
static function updaterandomfeed_real($dbh) {
|
||||||
|
|
||||||
// Test if the feed need a update (update interval exceded).
|
// Test if the feed need a update (update interval exceded).
|
||||||
if (DB_TYPE == "pgsql") {
|
if (DB_TYPE == "pgsql") {
|
||||||
$update_limit_qpart = "AND ((
|
$update_limit_qpart = "AND ((
|
||||||
@@ -508,7 +509,7 @@ class RPC extends Handler_Protected {
|
|||||||
$random_qpart = sql_random_function();
|
$random_qpart = sql_random_function();
|
||||||
|
|
||||||
// We search for feed needing update.
|
// We search for feed needing update.
|
||||||
$result = $this->dbh->query("SELECT ttrss_feeds.feed_url,ttrss_feeds.id
|
$result = $dbh->query("SELECT ttrss_feeds.feed_url,ttrss_feeds.id
|
||||||
FROM
|
FROM
|
||||||
ttrss_feeds, ttrss_users, ttrss_user_prefs
|
ttrss_feeds, ttrss_users, ttrss_user_prefs
|
||||||
WHERE
|
WHERE
|
||||||
@@ -527,7 +528,7 @@ class RPC extends Handler_Protected {
|
|||||||
|
|
||||||
$tstart = time();
|
$tstart = time();
|
||||||
|
|
||||||
while ($line = $this->dbh->fetch_assoc($result)) {
|
while ($line = $dbh->fetch_assoc($result)) {
|
||||||
$feed_id = $line["id"];
|
$feed_id = $line["id"];
|
||||||
|
|
||||||
if (time() - $tstart < ini_get("max_execution_time") * 0.7) {
|
if (time() - $tstart < ini_get("max_execution_time") * 0.7) {
|
||||||
@@ -551,6 +552,10 @@ class RPC extends Handler_Protected {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updaterandomfeed() {
|
||||||
|
RPC::updaterandomfeed_real($this->dbh);
|
||||||
|
}
|
||||||
|
|
||||||
private function markArticlesById($ids, $cmode) {
|
private function markArticlesById($ids, $cmode) {
|
||||||
|
|
||||||
$tmp_ids = array();
|
$tmp_ids = array();
|
||||||
|
|||||||
Reference in New Issue
Block a user