From be5f9ca0e1e4d3a2d1a06c39aa24874821b91cd1 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 22 Jul 2009 09:25:27 +0100 Subject: [PATCH] Stop daemons using 100% CPU and hammering the DB server when the queue is empty (DBQueueManager-based only) --- lib/dbqueuemanager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index a37a8ffdf6..1df5af6c11 100644 --- a/lib/dbqueuemanager.php +++ b/lib/dbqueuemanager.php @@ -88,7 +88,9 @@ class DBQueueManager extends QueueManager do { $qi = Queue_item::top($queue); - if (!empty($qi)) { + if (empty($qi)) { + sleep(1); + } else { $notice = Notice::staticGet('id', $qi->notice_id); if (!empty($notice)) { $result = $notice; -- 2.39.5