Skip to content

Commit

Permalink
Fix queue size when using beantstalk driver (#19465)
Browse files Browse the repository at this point in the history
The "total_jobs" property is not the actual number of jobs left to process,
but the cumulative count of jobs created in this tube in the current beanstalkd process,
so it's not decreasing when a job is done.
I think it's better to return the "current_jobs_ready" because it is representing the actual number of jobs waiting to be processed.
  • Loading branch information
kbondurant authored and taylorotwell committed Jun 2, 2017
1 parent 78fedf7 commit 7ce053a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/BeanstalkdQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function size($queue = null)
{
$queue = $this->getQueue($queue);

return (int) $this->pheanstalk->statsTube($queue)->total_jobs;
return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready;
}

/**
Expand Down

0 comments on commit 7ce053a

Please sign in to comment.