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