-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait to reenqueue job post-interrupt until after callbacks are finished
When Sidekiq is being used as the queue adapter, it is possible for job-iteration to reenqueue the job after an interruption prior to the callbacks for the original job completing. This can create race conditions if shutdown or after_perform callbacks touch data that the new job will also touch. This can be solved by waiting until after all the callbacks on the original job are complete to reenqueue the iteration job. Rather than reenqueuing the job from within #iterate_with_enumerator, we can prepend an after_perform callback (which ensures the callback runs last) when JobIteration::Iteration is included and reenqueue the job there.
- Loading branch information
1 parent
7cfe08c
commit 4897d42
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters