-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Can't batch.enqueue the callback after retrying a job within the batch #822
Comments
Ok I found the spot: I was under the impression for some reason that adding jobs or calling enqueue again re-initiated the callback but that isn't happening now when i try. I'll look into this and maybe put up a pr if i think it's interesting enough. |
@v2kovac super happy to have you trying Batches out! If I'm understanding your example, If you wanted to try opening a PR, even if it simply has a failing test-case, that would be really helpful 🙏🏻 |
Ok the real problem here i figured it out, not sure why it's happening yet. steps:
trying to figure out why the stale record doesn't still just get updated to nil |
Ok duh, the stale record has finished_at -> nil, so setting nil -> nil doesn't trigger an activerecord update. |
@v2kovac right! I can make a fix for that. I think it's as simple as adding a |
Yeah not sure how it would handle this: Not sure if this is already addressed by the advisory lock, maybe it's blocking job adds until FYI the solution to the topline problem for me is just setting |
This is really helpful for you to think through this with me! Thank you 🙌🏻 I think I need to also reset Hopefully I have my thinking correct in #824 by now 😀 |
Awesome work with the batches release!
Happy to solve this problem myself, just wondering if you can point me to where in the codebase
batch.enqueue
doesn't re-initiate the batch callback if you retry a single job then callbatch.enqueue
again.eg:
batch.enqueue
works fine when all jobs are done, i can just make the callback happen over and overjob_inside_batch.retry_job
+batch.enqueue
doesn't work, it thinks i'm in the case where we've already enqueued the callbackWhy would i do this? Well sometimes I want to retry all the failed jobs on a custom basis, and still have the callback happen again if i ask via
batch.enqueue
when the retries are done. Think of it as a special case ofbatch.add
where i'm just retrying existing jobs instead of adding new ones.It seems like the callback enqueue isn't actually checking if a callback has already been enqueued, but rather checking the status of the jobs. I would like to put up a pr modifying that. Let me know if this wasn't enough context. Thanks again!
The text was updated successfully, but these errors were encountered: