Skip to content
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

Fix ActiveJob logging when callback chain is halted: #37830

Merged

Conversation

Edouard-chin
Copy link
Member

@Edouard-chin Edouard-chin commented Nov 28, 2019

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

@rails-bot rails-bot bot added the activejob label Nov 28, 2019
@Edouard-chin Edouard-chin force-pushed the ec-activejob-enqueue-and-perform-log branch from cb8b970 to bd4c614 Compare December 9, 2019 14:56
@Edouard-chin Edouard-chin force-pushed the ec-activejob-enqueue-and-perform-log branch from bd4c614 to 5466bed Compare December 9, 2019 15:17
- ### 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.
@Edouard-chin Edouard-chin force-pushed the ec-activejob-enqueue-and-perform-log branch from 5466bed to 0d3aec4 Compare December 9, 2019 15:18
@rafaelfranca rafaelfranca merged commit 7f4d222 into rails:master Dec 9, 2019
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants