mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Add synchronize around checkout_some
This commit is contained in:
parent
76eba76dec
commit
1c2b46a0f9
1 changed files with 5 additions and 1 deletions
|
@ -35,7 +35,11 @@ module DB
|
||||||
# the connection is registered in `@connections`
|
# the connection is registered in `@connections`
|
||||||
private def build_statement : Statement
|
private def build_statement : Statement
|
||||||
clean_connections
|
clean_connections
|
||||||
conn, existing = @db.checkout_some(@connections)
|
|
||||||
|
conn, existing = @mutex.synchronize do
|
||||||
|
@db.checkout_some(@connections)
|
||||||
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
stmt = conn.prepared.build(@query)
|
stmt = conn.prepared.build(@query)
|
||||||
rescue ex
|
rescue ex
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue