-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose some identifier for Worker and a way to query its status #1039
Comments
Hi, So what to do? In general, have an "images" or "conversions" table:
Your polling happens against the "conversions" table. This way lets you: a) switch backens See more in discussions here: https://www.reddit.com/r/rails/comments/naszfk/getting_job_status_in_rails/ Having said that, there are instances where a "job ID" exists, specifically job workflow coordination. We do carry job IDs in each individual implementation, so I'd be more than willing to expose this, because I see no reason not to. |
🤦 Jup makes total sense. I’ll pretty much build a “jobs” table to track them. Thank you for the reminder! (I say this, yet at the moment I am super time-limited) |
To provide the enhancement you originally wanted, it should be feasible.
NOTE: if the Redis provider cannot supply a job ID, then we can return a Result<Option>, and providers which do not support this return |
Feature Request
Is your feature request related to a problem? Please describe.
In my app I can upload (large) images. For the frontend I use the
image
crate to resize a much smaller thumbnail, but this can take a few seconds. I would like for this work to be scheduled into the background from the requst.Describe the solution you'd like
Scheduling in the background is possible with a Worker, which is awesome.
Ideally, there would be an identifier generated when I call
let job_id = ImageResizer::perform_later()
.I would then expose that ID to the frontend and let it poll on some endpoint to check when the job is done.
That way I can tell the user that the image has been uploaded, and then pop an extra notification when the background job is done and the image is available to use.
Describe alternatives you've considered
I have considered some kind of ID tracking in the job itself where I track jobs for a given resource (recipe, in my case) in a separate table but that sounds awfully annoying.
The text was updated successfully, but these errors were encountered: