Make sure to return the connection to the pool in case of an exception preparing a query

This commit is contained in:
Ary Borenszweig 2016-06-29 15:01:26 -03:00
parent 22a5a41534
commit 2fc3f66a00

View file

@ -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: