File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
lib/active_record/connection_adapters/abstract Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -614,7 +614,7 @@ def checkout_for_exclusive_access(checkout_timeout)
614
614
615
615
msg << " (#{ thread_report . join ( ', ' ) } )" if thread_report . any?
616
616
617
- raise ExclusiveConnectionTimeoutError , msg
617
+ raise ExclusiveConnectionTimeoutError . new ( msg , connection_pool : self )
618
618
end
619
619
620
620
def with_new_connections_blocked
@@ -670,6 +670,8 @@ def acquire_connection(checkout_timeout)
670
670
reap
671
671
@available . poll ( checkout_timeout )
672
672
end
673
+ rescue ConnectionTimeoutError => ex
674
+ raise ex . set_pool ( self )
673
675
end
674
676
675
677
#--
Original file line number Diff line number Diff line change @@ -110,9 +110,10 @@ def test_full_pool_exception
110
110
@pool . checkout_timeout = 0.001 # no need to delay test suite by waiting the whole full default timeout
111
111
@pool . size . times { assert @pool . checkout }
112
112
113
- assert_raises ( ConnectionTimeoutError ) do
113
+ error = assert_raises ( ConnectionTimeoutError ) do
114
114
@pool . checkout
115
115
end
116
+ assert_equal @pool , error . connection_pool
116
117
end
117
118
118
119
def test_full_pool_blocks
@@ -615,9 +616,10 @@ def test_non_bang_disconnect_and_clear_reloadable_connections_throw_exception_if
615
616
@pool . checkout_timeout = 0.001 # no need to delay test suite by waiting the whole full default timeout
616
617
[ :disconnect , :clear_reloadable_connections ] . each do |group_action_method |
617
618
@pool . with_connection do |connection |
618
- assert_raises ( ExclusiveConnectionTimeoutError ) do
619
+ error = assert_raises ( ExclusiveConnectionTimeoutError ) do
619
620
new_thread { @pool . public_send ( group_action_method ) } . join
620
621
end
622
+ assert_equal @pool , error . connection_pool
621
623
end
622
624
end
623
625
ensure
You can’t perform that action at this time.
0 commit comments