diff options
author | Sarven Capadisli <csarven@controlyourself.ca> | 2009-07-24 15:06:07 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@controlyourself.ca> | 2009-07-24 15:06:07 +0000 |
commit | bb2186527a138086efbffc56452bd29a9f06e643 (patch) | |
tree | 823b2aeff5b47de5ee1406658b0a6528db4e26d8 /lib | |
parent | 8d2aeb7082cca4a19b3700b62cae77cf50260217 (diff) | |
parent | a3a5d23c54bfd2207728a957f370fc83ebfc4c65 (diff) |
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dbqueuemanager.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index 1df5af6c1..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)); @@ -120,7 +124,7 @@ class DBQueueManager extends QueueManager } else { if (empty($qi->claimed)) { $this->_log(LOG_WARNING, 'Reluctantly releasing unclaimed queue item '. - 'for '.$notice->id.', queue '.$queue); + 'for '.$notice->id.', queue '.$queue); } $qi->delete(); $qi->free(); @@ -147,7 +151,7 @@ class DBQueueManager extends QueueManager } else { if (empty($qi->claimed)) { $this->_log(LOG_WARNING, 'Ignoring failure for unclaimed queue item '. - 'for '.$notice->id.', queue '.$queue); + 'for '.$notice->id.', queue '.$queue); } else { $orig = clone($qi); $qi->claimed = null; |