summaryrefslogtreecommitdiff
path: root/classes/rpc.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-07-24 12:55:10 +0400
committerAndrew Dolgov <[email protected]>2013-07-24 12:55:10 +0400
commit113c3dec9e02f48df22cda107257d15655e3f007 (patch)
treeedbe956482f70dfc968aa5ac90865a7d12ff987e /classes/rpc.php
parent9fa8d652c2dc312e7af539e52b80436716e8dcc6 (diff)
make globalUpdateFeeds handler use simple update mechanism to prevent script timeouts
Diffstat (limited to 'classes/rpc.php')
-rw-r--r--classes/rpc.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/classes/rpc.php b/classes/rpc.php
index 9cc8e7046..cfd9c4f22 100644
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -476,7 +476,8 @@ class RPC extends Handler_Protected {
print json_encode(array("wide" => $wide));
}
- function updaterandomfeed() {
+ static function updaterandomfeed_real($dbh) {
+
// Test if the feed need a update (update interval exceded).
if (DB_TYPE == "pgsql") {
$update_limit_qpart = "AND ((
@@ -508,7 +509,7 @@ class RPC extends Handler_Protected {
$random_qpart = sql_random_function();
// 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
ttrss_feeds, ttrss_users, ttrss_user_prefs
WHERE
@@ -527,7 +528,7 @@ class RPC extends Handler_Protected {
$tstart = time();
- while ($line = $this->dbh->fetch_assoc($result)) {
+ while ($line = $dbh->fetch_assoc($result)) {
$feed_id = $line["id"];
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) {
$tmp_ids = array();