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

I have a job that is triggered based on user interaction. The job takes a CSV file, runs throttled API calls on each record, then inserts ( Model->save() ) records into MySQL. The process is lengthy and can sometimes take in excess of a few days. There should only be ONE csv file being processed at a time. Diving deeper into Laravel, I decided to try out Queue for this as opposed to monitoring the filesystem for new files and maintain my own queue/process management.

I have the Queue working and the Job runs when I issue “php artisan queue:worker”. My job has a few instance variables such $progress and $time_started. What I’d like to be able to do is monitor the status of the job by getting these instance variables within another controller method. Essentially, I want to be able to present the user with a Status Page of the running jobs.

Is this doable using Queue?

Last updated 3 years ago.
0

I once has a similar kind of problem. I solved it by :

  • Creating a database for QueueJobs. (id, job_id, upload_id, user_id, progress, ...)
  • When you receive a job from queue, create a new QueueJobs record setting the progress to 0.
  • In your jobHandlerClass, inside your setProgress() method, whenever the progress value is changed, update the same to the database.

This way, you can link the upload done by the user to queue, track and show the status for the same to the use.

0

mcraz,

Yea, that was going to be my plan B. I was trying to avoid the extra layer of complexity but it's looking like it may be my only choice.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

maxirus maxirus Joined 11 Mar 2015

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.