Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.2 Job with delay fires instantly instead of waiting

I'm creating an application with the Laravel 5.2 framework. In my application there is a job that I want to fire 2 days after the event.

This is the code where an instance of the right job is made and where I set the delay to the amount of seconds that equals 2 days.

 $job = (new RemoveNotPayedOrder($order))->delay(172800);

 $this->dispatch($job);

Right when the code reaches the dispatch method the job gets fired instantly instead of waiting the seconds specified by me in the delay method.

I generated the Job class with the make:job command provided by php artisan.

I've read the docs: http://laravel.com/docs/5.1/queues#delayed-jobs and I think my code is correct. Any ideas on what could be wrong?

like image 907
SemperMemento Avatar asked Jan 23 '26 22:01

SemperMemento


1 Answers

The issue ended up being the queue driver (in config/queue.php) was set to 'synchronous'.

like image 148
castis Avatar answered Jan 26 '26 12:01

castis