Skip to content

Commit 906ab94

Browse files
Avoid clearing context in executor to_run hooks
This clears context that may be set in an earlier middleware, such as `Rack::Events`.
1 parent 19887de commit 906ab94

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

activejob/lib/active_job/railtie.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class Railtie < Rails::Railtie # :nodoc:
101101
initializer "active_job.clear_event_reporter_context" do
102102
ActiveSupport.on_load(:active_job) do
103103
ActiveJob::Callbacks.singleton_class.set_callback(:execute, :around) do |_, inner|
104+
ActiveSupport.event_reporter.clear_context
104105
inner.call
105106
ensure
106107
ActiveSupport.event_reporter.clear_context

activesupport/lib/active_support/railtie.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class Railtie < Rails::Railtie # :nodoc:
4747

4848
app.executor.to_run do
4949
ActiveSupport::ExecutionContext.push
50-
ActiveSupport.event_reporter.clear_context
5150
end
5251

5352
app.executor.to_complete do

0 commit comments

Comments
 (0)