mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Make sure to return the connection to the pool in case of an exception preparing a query
This commit is contained in:
parent
22a5a41534
commit
2fc3f66a00
1 changed files with 7 additions and 1 deletions
|
@ -30,7 +30,13 @@ module DB
|
||||||
|
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
def prepare(query)
|
def prepare(query)
|
||||||
get_from_pool.prepare(query)
|
conn = get_from_pool
|
||||||
|
begin
|
||||||
|
conn.prepare(query)
|
||||||
|
rescue ex
|
||||||
|
return_to_pool(conn)
|
||||||
|
raise ex
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
|
|
Loading…
Reference in a new issue