Skip to content

Commit

Permalink
Fix bug where scheduler sleeps when processing a delayed queue
Browse files Browse the repository at this point in the history
The function handleDelayedItems() was overwriting the parameter
$timestamp from the call nextDelayedTimestamp() with timestamp of
the most delayed job. Therefor it would only process 1 seconds
worth of items before sleeping. A slighty delayed queue could
fall very far behind.
  • Loading branch information
mhagstrand committed Nov 18, 2016
1 parent 894b41d commit 073f25f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ResqueScheduler/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function work($interval = null)
*/
public function handleDelayedItems($timestamp = null)
{
while (($timestamp = ResqueScheduler::nextDelayedTimestamp($timestamp)) !== false) {
while (($oldestJobTimestamp = ResqueScheduler::nextDelayedTimestamp($timestamp)) !== false) {
$this->updateProcLine('Processing Delayed Items');
$this->enqueueDelayedItemsForTimestamp($timestamp);
$this->enqueueDelayedItemsForTimestamp($oldestJobTimestamp);
}
}

Expand Down

0 comments on commit 073f25f

Please sign in to comment.