Skip to content

Commit ebd42e3

Browse files
Remove custom middleware for context clearing, rely on on_complete instead
1 parent fa3a122 commit ebd42e3

File tree

7 files changed

+2
-118
lines changed

7 files changed

+2
-118
lines changed

actionpack/lib/action_dispatch.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class MissingController < NameError
7070
autoload :HostAuthorization
7171
autoload :RequestId
7272
autoload :Callbacks
73-
autoload :ClearEventReporterContext
7473
autoload :Cookies
7574
autoload :ActionableExceptions
7675
autoload :DebugExceptions

actionpack/lib/action_dispatch/middleware/clear_event_reporter_context.rb

Lines changed: 0 additions & 35 deletions
This file was deleted.

actionpack/test/dispatch/clear_event_reporter_context_test.rb

Lines changed: 0 additions & 67 deletions
This file was deleted.

activejob/lib/active_job/railtie.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,6 @@ class Railtie < Rails::Railtie # :nodoc:
9898
end
9999
end
100100

101-
initializer "active_job.clear_event_reporter_context" do
102-
ActiveSupport.on_load(:active_job) do
103-
ActiveJob::Callbacks.singleton_class.set_callback(:execute, :around) do |_, inner|
104-
ActiveSupport.event_reporter.clear_context
105-
inner.call
106-
ensure
107-
ActiveSupport.event_reporter.clear_context
108-
end
109-
end
110-
end
111-
112101
initializer "active_job.query_log_tags" do |app|
113102
query_logs_tags_enabled = app.config.respond_to?(:active_record) &&
114103
app.config.active_record.query_log_tags_enabled &&

activesupport/lib/active_support/railtie.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class Railtie < Rails::Railtie # :nodoc:
5252
app.executor.to_complete do
5353
ActiveSupport::CurrentAttributes.clear_all
5454
ActiveSupport::ExecutionContext.pop
55+
puts "to_complete in activesupport railtie, clearing context"
56+
ActiveSupport.event_reporter.clear_context
5557
end
5658

5759
ActiveSupport.on_load(:active_support_test_case) do

railties/lib/rails/application/default_middleware_stack.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def build_stack
5858
middleware.use ::Rails::Rack::SilenceRequest, path: path
5959
end
6060

61-
middleware.use ::ActionDispatch::ClearEventReporterContext
6261
middleware.use ::Rails::Rack::Logger, config.log_tags
6362
middleware.use ::ActionDispatch::ShowExceptions, show_exceptions_app
6463
middleware.use ::ActionDispatch::DebugExceptions, app, config.debug_exception_response_format

railties/test/commands/middleware_test.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def app
3636
"Rack::MethodOverride",
3737
"ActionDispatch::RequestId",
3838
"ActionDispatch::RemoteIp",
39-
"ActionDispatch::ClearEventReporterContext",
4039
"Rails::Rack::Logger",
4140
"ActionDispatch::ShowExceptions",
4241
"ActionDispatch::DebugExceptions",
@@ -72,7 +71,6 @@ def app
7271
"Rack::MethodOverride",
7372
"ActionDispatch::RequestId",
7473
"ActionDispatch::RemoteIp",
75-
"ActionDispatch::ClearEventReporterContext",
7674
"Rails::Rack::Logger",
7775
"ActionDispatch::ShowExceptions",
7876
"ActionDispatch::DebugExceptions",
@@ -105,7 +103,6 @@ def app
105103
"Rack::Runtime",
106104
"ActionDispatch::RequestId",
107105
"ActionDispatch::RemoteIp",
108-
"ActionDispatch::ClearEventReporterContext",
109106
"Rails::Rack::Logger",
110107
"ActionDispatch::ShowExceptions",
111108
"ActionDispatch::DebugExceptions",

0 commit comments

Comments
 (0)