diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-23 14:56:21 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-23 14:56:21 -0700 |
commit | a3a5d23c54bfd2207728a957f370fc83ebfc4c65 (patch) | |
tree | c3e6e3b8e463b743f0f64da300718b2922d7fe0a /lib | |
parent | f2270067892750e538469ee9d44900ca254938a1 (diff) |
dbqueuemanager a little more sane about sleeping
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dbqueuemanager.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index 013636191..19aa9f3ae 100644 --- a/lib/dbqueuemanager.php +++ b/lib/dbqueuemanager.php @@ -22,7 +22,6 @@ * @category QueueManager * @package Laconica * @author Evan Prodromou <evan@controlyourself.ca> - * @author Sarven Capadisli <csarven@controlyourself.ca> * @copyright 2009 Control Yourself, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://laconi.ca/ @@ -86,10 +85,14 @@ class DBQueueManager extends QueueManager $start = time(); $result = null; + $sleeptime = 1; + do { $qi = Queue_item::top($queue); if (empty($qi)) { - sleep(1); + $this->_log(LOG_DEBUG, "No new queue items, sleeping $sleeptime seconds."); + sleep($sleeptime); + $sleeptime *= 2; } else { $notice = Notice::staticGet('id', $qi->notice_id); if (!empty($notice)) { @@ -100,6 +103,7 @@ class DBQueueManager extends QueueManager $qi->free(); $qi = null; } + $sleeptime = 1; } } while (empty($result) && (is_null($timeout) || (time() - $start) < $timeout)); |