Support the ongoing development of Laravel.io →
posted 8 years ago
Queues
Last updated 2 years ago.
0

Hi trevorovert,

I have a similar setup using L5.1 and my job classes also implements SelfHandling.

class DataProcessing extends Job implements SelfHandling, ShouldQueue

I am not sure if this would be useful, but I also don't pass a request object to instances of my job classes. I use the request data in my controller to create an instance of the object model, which I then pass through as a serialized object onto the job queue. This all runs in the background, with each job's execution time averaging between 45 seconds to a minute and a half, and my controller redirects the client to a status view to monitor progress, pretty much instantly.

I also use the DispatchesJobs trait in my controller

use DispatchesJobs;

Also, I have a delay on my dispatch call in my controller, to allow the front-end to load before firing off the job:

// Dispatch Job $this->dispatch((new DetaProcessing($object)) ->onQueue('process-data-queue') ->delay(5));

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.

© 2024 Laravel.io - All rights reserved.