Support the ongoing development of Laravel.io →
posted 10 years ago
Queues

I have a working Queue setup with Beanstalk and Laravel 5.0. I have a loop where I queue a number of jobs. The job is to download a large file from another server, via CURL, and save it locally

	foreach($to_queue as $id => $file) {
		Queue::push(new DownloadFile($id));
	}

This works fine. But the thing is say I push 10 jobs to the queue the http response of my page is only returning when all the jobs have been executed, I would have thought it would return once the jobs were pushed but before they were executed.

I wonder if this is something to do with the way Laravel packages a job and the file download?

Any advice appreciated,

Last updated 3 years ago.
0

First of all, check that you are actually using beanstalkd as your queue driver. Because right now, it looks like you are using the default sync. Note, that to switch to beanstalkd, you need to specify it in your .env file:

QUEUE_DRIVER=beanstalkd

Changing this string your app.queue.php file:

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

to

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

won't change the driver. Second argument here defines the default value if QUEUE_DRIVER environment variable is not set (and it is by default, in .env file).

0

Sign in to participate in this thread!

Eventy

Your banner here too?

netm netm Joined 2 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.