From a97ac7993f4c9eab3bd57f30747ca7e9ac1c9df1 Mon Sep 17 00:00:00 2001 From: Francis Devine Date: Mon, 3 Jul 2023 15:33:32 +1200 Subject: [PATCH] Update the crawl condition when continuing the loop early We've encountered pathological issues where the crons appear to get stuck within these loops and never ever finish, which leads to the rest of the site tasks being starved of resource. --- classes/robot/crawler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classes/robot/crawler.php b/classes/robot/crawler.php index f370699..2da03e1 100644 --- a/classes/robot/crawler.php +++ b/classes/robot/crawler.php @@ -556,6 +556,7 @@ public function process_queue($verbose = false) { // Get a new zero second timeout lock for the resource. if (!$lock = $lockfactory->get_lock($resource, 0)) { + $hastime = time() < $cronstop; // Check if we need to break from processing continue; // Try crawl the next node, this one is already being processed. } @@ -567,6 +568,7 @@ public function process_queue($verbose = false) { $persistent = new url(0, $node); $persistent->update(); $lock->release(); + $hastime = time() < $cronstop; // Check if we need to break from processing continue; }