1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove leak when using CurrentAttributes in thread variables

The test for CurrentAttributes using thread-local variables leaks
an instance in Thread.current.

Usually instances are reset in the test helper but the objects remain:
activesupport/lib/active_support/current_attributes/test_helper.rb:11

In this situation we use clear_all to make sure we don't leave instances
behind when the configuration is changed.
This commit is contained in:
Étienne Barrié 2021-07-27 10:30:34 +02:00
parent 85e4ac6f86
commit 39b382cf78

View file

@ -144,6 +144,7 @@ module ActiveSupport
end end
def _use_thread_variables=(value) # :nodoc: def _use_thread_variables=(value) # :nodoc:
clear_all
@@use_thread_variables = value @@use_thread_variables = value
end end
@@use_thread_variables = false @@use_thread_variables = false