mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
The test setup is not threadsafe. Wrap in a mutex.
This commit is contained in:
parent
227cfe50c6
commit
1d55e07ff9
1 changed files with 7 additions and 3 deletions
|
@ -88,10 +88,14 @@ module ActiveSupport
|
|||
!ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
|
||||
end
|
||||
|
||||
@@class_setup_mutex = Mutex.new
|
||||
|
||||
def _run_class_setup # class setup method should only happen in parent
|
||||
unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
|
||||
self.class.setup if self.class.respond_to?(:setup)
|
||||
@@ran_class_setup = true
|
||||
@@class_setup_mutex.synchronize do
|
||||
unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
|
||||
self.class.setup if self.class.respond_to?(:setup)
|
||||
@@ran_class_setup = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue