From 3374c26fc5e4e1e6701e90143c3dc1b269ce1998 Mon Sep 17 00:00:00 2001 From: Karim Bouheraoua Date: Fri, 2 Jun 2017 20:20:28 +0200 Subject: [PATCH] Fix queue size when using beantstalk driver 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. --- src/Illuminate/Queue/BeanstalkdQueue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/BeanstalkdQueue.php b/src/Illuminate/Queue/BeanstalkdQueue.php index 24dc9c0b4f8f..54e8e42a4983 100755 --- a/src/Illuminate/Queue/BeanstalkdQueue.php +++ b/src/Illuminate/Queue/BeanstalkdQueue.php @@ -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; } /**