File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
activerecord/lib/active_record/connection_adapters/abstract Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -541,12 +541,14 @@ def clear_reloadable_connections!
541
541
# - ActiveRecord::ConnectionTimeoutError no connection can be obtained from the pool.
542
542
def checkout ( checkout_timeout = @checkout_timeout )
543
543
if @pinned_connection
544
- synchronize do
545
- @pinned_connection . verify!
546
- # Any leased connection must be in @connections otherwise
547
- # some methods like #connected? won't behave correctly
548
- unless @connections . include? ( @pinned_connection )
549
- @connections << @pinned_connection
544
+ @pinned_connection . lock . synchronize do
545
+ synchronize do
546
+ @pinned_connection . verify!
547
+ # Any leased connection must be in @connections otherwise
548
+ # some methods like #connected? won't behave correctly
549
+ unless @connections . include? ( @pinned_connection )
550
+ @connections << @pinned_connection
551
+ end
550
552
end
551
553
end
552
554
@pinned_connection
You can’t perform that action at this time.
0 commit comments