Search code examples
phplaravelqueuebeanstalkdlaravel-artisan

Laravel Queue is repeating with beanstalkd and redis


I'm using laravel Queues with beanstalkd driver ( same thing happened with redis ), when i push a Queue it just keeps repeating

What i did simply is:

  1. Install beanstalkd , run beanstalkd
  2. Run php artisan queue:listen
  3. In the terminal window of queue listen , it just keeps repeating after every few seconds: Processed: SendEmail

I thought the queue wasn't empty, so tried flushing it out ( it was empty ), failed jobs table is empty.

Second test , stopped beanstlkd and queue listen , i have a controller that simply says:

..
Queue::push('SendEmail@fire', array('message' => $msg->id));

There's no loops in the controller at all, nor in the send email function


Solution

  • you need to delete job at end of SendEmail@fire

    Class SendMail {
        public function fire($job, $data){
            ///...
            $job->delete();
        }
    }