Saturday, April 1, 2017

Queue worker fails on all second jobs since Laravel 5.4

My application has a serie of jobs that are handled by Laravel's queuing system (using Beanstalkd driver).

The application does the following: Each job is handled by a Job class. This Job class creates a Command class which is dispatched through Laravel's command bus.

This worked up until Laravel 5.3. After updating to 5.4, every job after the first fails. What happens is the following:

First job:

  • Handle on the Job class is called.
  • Command class is created, as well as a pipeline (Laravel's command bus) to put the command through.
  • Command is dispatched through the pipeline.
  • All is well, Job successful.

Second job

  • Handle on the Job class is called.
  • No new Command is created.
  • The Job class is dispatched through the command bus, instead of the lacking Command class. Resulting in fatal errors.

If I start a queue worker and have it just sync one job at a time (and start the worker again each time), no problems. Queue:listen also works. It only fails when using queue:work, which uses the deamon parameter.

I'm not really sure where to look. Maybe something changed in either Laravel's command bus or in it's queueing system? Why would new Command() not work in a second job?



via wouthoekstra

Advertisement