File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -164,8 +164,19 @@ def supports_concurrent_connections?
164164 !@memory_database
165165 end
166166
167+ def connected?
168+ !( @raw_connection . nil? || @raw_connection . closed? )
169+ end
170+
167171 def active?
168- @raw_connection && !@raw_connection . closed?
172+ if connected?
173+ @lock . synchronize do
174+ if @raw_connection &.active?
175+ verified!
176+ true
177+ end
178+ end
179+ end || false
169180 end
170181
171182 def return_value_after_insert? ( column ) # :nodoc:
@@ -177,10 +188,11 @@ def return_value_after_insert?(column) # :nodoc:
177188 # Disconnects from the database if already connected. Otherwise, this
178189 # method does nothing.
179190 def disconnect!
180- super
181-
182- @raw_connection &.close rescue nil
183- @raw_connection = nil
191+ @lock . synchronize do
192+ super
193+ @raw_connection &.close rescue nil
194+ @raw_connection = nil
195+ end
184196 end
185197
186198 def supports_index_sort_order?
You can’t perform that action at this time.
0 commit comments