From c29fa6fc911a272e981fb48628cca23c85124efe Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 11 Dec 2022 00:07:50 +0100 Subject: [PATCH] speed up when no feeds to update --- inc/class.zoneclearfeedserver.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/inc/class.zoneclearfeedserver.php b/inc/class.zoneclearfeedserver.php index d450e0e..45d466d 100644 --- a/inc/class.zoneclearfeedserver.php +++ b/inc/class.zoneclearfeedserver.php @@ -426,9 +426,7 @@ class zoneclearFeedServer return false; } - # Set feeds user - $this->enableUser(true); - + $enabled = false; $updates = false; $loop_mem = []; @@ -443,9 +441,14 @@ class zoneclearFeedServer while ($f->fetch()) { # Check if feed need update - if ($id || $i < $limit && $f->feed_status == 1 - && $time > $f->feed_upd_last + $f->feed_upd_int + if ($id + || $i < $limit && $f->feed_status == 1 && ($time > $f->feed_upd_last + $f->feed_upd_int) ) { + if (!$enabled) { + # Set feeds user + $this->enableUser(true); + $enabled = true; + } $i++; $feed = self::readFeed($f->feed_feed); @@ -693,7 +696,9 @@ class zoneclearFeedServer } } } - $this->enableUser(false); + if ($enabled) { + $this->enableUser(false); + } $this->unlockUpdate(); return true;