Skip to content

Commit 7ce053a

Browse files
kbonduranttaylorotwell
authored andcommitted
Fix queue size when using beantstalk driver (#19465)
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.
1 parent 78fedf7 commit 7ce053a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Queue/BeanstalkdQueue.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function size($queue = null)
5555
{
5656
$queue = $this->getQueue($queue);
5757

58-
return (int) $this->pheanstalk->statsTube($queue)->total_jobs;
58+
return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready;
5959
}
6060

6161
/**

0 commit comments

Comments
 (0)