Queue: push () handled synchronously in Laravel 5

I am running Laravel 5 and I am trying to get a command in the queue. I run it:

Queue::push( new MyCommand() );

To create team I, I did:

php artisan make:command --queued MyCommand

MyCommand contains sleep(20)andfile_put_contents('test.txt','I work!')

Command line I run:

beanstalkd -l 127.0.0.1 -p 11301 &
php artisan queue:listen &

And config / queue.php matters:

'default'     => env('QUEUE_DRIVER', 'beanstalkd'),

...

'beanstalkd' => [
  'driver' => 'beanstalkd',
  'host'   => 'localhost:11301',
  'queue'  => 'default',
  'ttr'    => 60,
],

When I click the code from the browser, it freezes for 20 seconds and discards the file before terminating, rather than returning immediately.

Is there anything else I need to do for the correct command queue in the background?

+4
source share
1 answer

Make sure that the file .envdoes not have a value QUEUE_DRIVERother than beanstalkd. Method env():

'default' => env('QUEUE_DRIVER', 'beanstalkd'),

, , , beanstalkd, .

+9

All Articles