aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/behaviors/connection_pool_behavior.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/cache/behaviors/connection_pool_behavior.rb')
-rw-r--r--activesupport/test/cache/behaviors/connection_pool_behavior.rb56
1 files changed, 26 insertions, 30 deletions
diff --git a/activesupport/test/cache/behaviors/connection_pool_behavior.rb b/activesupport/test/cache/behaviors/connection_pool_behavior.rb
index 4d1901a173..5e66e0b202 100644
--- a/activesupport/test/cache/behaviors/connection_pool_behavior.rb
+++ b/activesupport/test/cache/behaviors/connection_pool_behavior.rb
@@ -7,24 +7,22 @@ module ConnectionPoolBehavior
threads = []
emulating_latency do
- begin
- cache = ActiveSupport::Cache.lookup_store(store, { pool_size: 2, pool_timeout: 1 }.merge(store_options))
- cache.clear
-
- assert_raises Timeout::Error do
- # One of the three threads will fail in 1 second because our pool size
- # is only two.
- 3.times do
- threads << Thread.new do
- cache.read("latency")
- end
+ cache = ActiveSupport::Cache.lookup_store(store, { pool_size: 2, pool_timeout: 1 }.merge(store_options))
+ cache.clear
+
+ assert_raises Timeout::Error do
+ # One of the three threads will fail in 1 second because our pool size
+ # is only two.
+ 3.times do
+ threads << Thread.new do
+ cache.read("latency")
end
-
- threads.each(&:join)
end
- ensure
- threads.each(&:kill)
+
+ threads.each(&:join)
end
+ ensure
+ threads.each(&:kill)
end
ensure
Thread.report_on_exception = original_report_on_exception
@@ -34,24 +32,22 @@ module ConnectionPoolBehavior
threads = []
emulating_latency do
- begin
- cache = ActiveSupport::Cache.lookup_store(store, store_options)
- cache.clear
-
- assert_nothing_raised do
- # Default connection pool size is 5, assuming 10 will make sure that
- # the connection pool isn't used at all.
- 10.times do
- threads << Thread.new do
- cache.read("latency")
- end
+ cache = ActiveSupport::Cache.lookup_store(store, store_options)
+ cache.clear
+
+ assert_nothing_raised do
+ # Default connection pool size is 5, assuming 10 will make sure that
+ # the connection pool isn't used at all.
+ 10.times do
+ threads << Thread.new do
+ cache.read("latency")
end
-
- threads.each(&:join)
end
- ensure
- threads.each(&:kill)
+
+ threads.each(&:join)
end
+ ensure
+ threads.each(&:kill)
end
end