From: CiaranG Date: Wed, 22 Jul 2009 08:25:27 +0000 (+0100) Subject: Stop daemons using 100% CPU and hammering the DB server when the queue is empty ... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=be5f9ca0e1e4d3a2d1a06c39aa24874821b91cd1;p=quix0rs-gnu-social.git Stop daemons using 100% CPU and hammering the DB server when the queue is empty (DBQueueManager-based only) --- 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;