Skip to content

Commit

Permalink
Correct the timing of loading ActiveJobExtensions (#1464)
Browse files Browse the repository at this point in the history
* Correct the timing of loading ActiveJobExtensions

See
#1249 (comment)

* Update changelog
  • Loading branch information
st0012 authored Jun 4, 2021
1 parent a2d6bbe commit a72ddc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Remove response from breadcrumb and span [#1463](https://github.com/getsentry/sentry-ruby/pull/1463)
- Fixes the issue mentioned in this [comment](https://github.com/getsentry/sentry-ruby/pull/1199#issuecomment-773069840)
- Correct the timing of loading ActiveJobExtensions [#1464](https://github.com/getsentry/sentry-ruby/pull/1464)
- Fixes [#1249](https://github.com/getsentry/sentry-ruby/issues/1249)

## 4.5.0

Expand Down
8 changes: 7 additions & 1 deletion sentry-rails/lib/sentry/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ class Railtie < ::Rails::Railtie
app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
end

# because the extension works by registering the around_perform callcack, it should always be ran
# before the application is eager-loaded (before user's jobs register their own callbacks)
# See https://github.com/getsentry/sentry-ruby/issues/1249#issuecomment-853871871 for the detail explanation
initializer "sentry.extend_active_job", before: :eager_load! do |app|
extend_active_job if defined?(ActiveJob)
end

config.after_initialize do |app|
next unless Sentry.initialized?

configure_project_root
configure_trusted_proxies
extend_controller_methods if defined?(ActionController)
extend_active_job if defined?(ActiveJob)
patch_background_worker if defined?(ActiveRecord)
override_streaming_reporter if defined?(ActionView)
setup_backtrace_cleanup_callback
Expand Down

0 comments on commit a72ddc7

Please sign in to comment.