aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/base_test.rb
diff options
context:
space:
mode:
authorJerry D'Antonio <stumpjumper@gmail.com>2015-07-13 14:22:54 -0400
committerJerry D'Antonio <stumpjumper@gmail.com>2015-07-13 15:44:21 -0400
commit284a9ba8ecbbaac598179af6fc65aed7bcf5785b (patch)
tree1f9f0ad6dff487a66235d52dca959693ca5c9a34 /activerecord/test/cases/base_test.rb
parent08e41a043218583d34e34316df82d38e4d7f1b55 (diff)
downloadrails-284a9ba8ecbbaac598179af6fc65aed7bcf5785b.tar.gz
rails-284a9ba8ecbbaac598179af6fc65aed7bcf5785b.tar.bz2
rails-284a9ba8ecbbaac598179af6fc65aed7bcf5785b.zip
Replaced `ActiveSupport::Concurrency::Latch` with concurrent-ruby.
The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`, which is functionally equivalent.
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r--activerecord/test/cases/base_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 31c31e4329..382adbbdc7 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
require "cases/helper"
-require 'active_support/concurrency/latch'
require 'models/post'
require 'models/author'
require 'models/topic'
@@ -29,6 +28,7 @@ require 'models/bird'
require 'models/car'
require 'models/bulb'
require 'rexml/document'
+require 'concurrent/atomics'
class FirstAbstractClass < ActiveRecord::Base
self.abstract_class = true
@@ -1506,20 +1506,20 @@ class BasicsTest < ActiveRecord::TestCase
orig_handler = klass.connection_handler
new_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
after_handler = nil
- latch1 = ActiveSupport::Concurrency::Latch.new
- latch2 = ActiveSupport::Concurrency::Latch.new
+ latch1 = Concurrent::CountDownLatch.new
+ latch2 = Concurrent::CountDownLatch.new
t = Thread.new do
klass.connection_handler = new_handler
- latch1.release
- latch2.await
+ latch1.count_down
+ latch2.wait
after_handler = klass.connection_handler
end
- latch1.await
+ latch1.wait
klass.connection_handler = orig_handler
- latch2.release
+ latch2.count_down
t.join
assert_equal after_handler, new_handler