File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
activerecord/lib/active_record/connection_adapters/abstract Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -92,14 +92,18 @@ def initialize(spec)
92
92
# #connection can be called any number of times; the connection is
93
93
# held in a hash keyed by the thread id.
94
94
def connection
95
- @reserved_connections [ current_connection_id ] ||= checkout
95
+ synchronize do
96
+ @reserved_connections [ current_connection_id ] ||= checkout
97
+ end
96
98
end
97
99
98
100
# Is there an open connection that is being used for the current thread?
99
101
def active_connection?
100
- @reserved_connections . fetch ( current_connection_id ) {
101
- return false
102
- } . in_use?
102
+ synchronize do
103
+ @reserved_connections . fetch ( current_connection_id ) {
104
+ return false
105
+ } . in_use?
106
+ end
103
107
end
104
108
105
109
# Signal that the thread is finished with the current connection.
You can’t perform that action at this time.
0 commit comments