Track connections only if statements_cache is enabled

This commit is contained in:
Brian J. Cardiff 2023-11-19 16:48:38 -03:00
parent ad41c258c8
commit 89e32c6e0a

View file

@ -53,7 +53,7 @@ module DB
conn.release conn.release
raise ex raise ex
end end
unless existing if !existing && @db.prepared_statements_cache?
@mutex.synchronize do @mutex.synchronize do
@connections << WeakRef.new(conn) @connections << WeakRef.new(conn)
end end
@ -62,6 +62,8 @@ module DB
end end
private def clean_connections private def clean_connections
return unless @db.prepared_statements_cache?
@mutex.synchronize do @mutex.synchronize do
# remove disposed or closed connections # remove disposed or closed connections
@connections.each do |ref| @connections.each do |ref|