Fix ActiveJob logging when callback chain is halted:#37830
Merged
rafaelfranca merged 1 commit intorails:masterfrom Dec 9, 2019
Merged
Fix ActiveJob logging when callback chain is halted:#37830rafaelfranca merged 1 commit intorails:masterfrom
rafaelfranca merged 1 commit intorails:masterfrom
Conversation
cb8b970 to
bd4c614
Compare
rafaelfranca
reviewed
Dec 9, 2019
bd4c614 to
5466bed
Compare
- ### Problem ActiveJob will always log "Enqueued MyJob (Job ID) ..." even if the job doesn't get enqueued through the adapter. Same problem happens when performing a Job, "Performed MyJob (Job ID) ..." will be logged even when job wasn't performed at all. This situation can happen either if the callback chain is terminated (before_enqueue throwing an `abort`) or if an exception is raised. ### Solution Check if the callback chain is aborted/exception is raised, and log accordingly.
5466bed to
0d3aec4
Compare
yykamei
added a commit
to yykamei/rails_band
that referenced
this pull request
May 30, 2022
`abort` was introduced in rails/rails#37830 It might be helpful to support this new event. So, I added it in `enqueue`, `enqueue_at`, and `perform` in `active_job`.
yykamei
added a commit
to yykamei/rails_band
that referenced
this pull request
May 30, 2022
`abort` was introduced in rails/rails#37830 It might be helpful to support this new event. So, I added it in `enqueue`, `enqueue_at`, and `perform` in `active_job`.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix ActiveJob logging when callback chain is halted:
Problem
ActiveJob will always log "Enqueued MyJob (Job ID) ..." even
if the job doesn't get enqueued through the adapter.
Same problem happens when performing a Job, "Performed MyJob (Job ID) ..." will be logged even when job wasn't performed at all.
This situation can happen either if the callback chain is terminated
(before_enqueue throwing an
abort) or if an exception is raised.Solution
Check if the callback chain is aborted/exception is raised, and log accordingly.
cc/ @rafaelfranca @casperisfine @etiennebarrie