Add synchronize around checkout_some

This commit is contained in:
Brian J. Cardiff 2023-04-21 16:19:35 -03:00
parent 76eba76dec
commit 1c2b46a0f9

View file

@ -35,7 +35,11 @@ module DB
# the connection is registered in `@connections`
private def build_statement : Statement
clean_connections
conn, existing = @db.checkout_some(@connections)
conn, existing = @mutex.synchronize do
@db.checkout_some(@connections)
end
begin
stmt = conn.prepared.build(@query)
rescue ex