mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Release connection when unprepared statements can't be built
Add specs Fix typo in docs
This commit is contained in:
parent
4fe3884898
commit
9b03aa6535
4 changed files with 31 additions and 2 deletions
|
@ -29,7 +29,7 @@ module DB
|
|||
end
|
||||
|
||||
# builds a statement over a real connection
|
||||
# the conneciton is registered in `@connections`
|
||||
# the connection is registered in `@connections`
|
||||
private def build_statement
|
||||
clean_connections
|
||||
conn, existing = @db.checkout_some(@connections)
|
||||
|
|
|
@ -15,7 +15,13 @@ module DB
|
|||
|
||||
# builds a statement over a real connection
|
||||
private def build_statement
|
||||
@db.pool.checkout.unprepared.build(@query)
|
||||
conn = @db.pool.checkout
|
||||
begin
|
||||
conn.unprepared.build(@query)
|
||||
rescue ex
|
||||
conn.release
|
||||
raise ex
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue