1
0
Fork 0
mirror of https://github.com/mperham/connection_pool synced 2023-03-27 23:22:21 -04:00

Remove tap usage, comment this necessary complexity

This commit is contained in:
Mike Perham 2015-01-18 11:01:03 -08:00
parent e1e3934350
commit 1e32fd797b

View file

@ -53,12 +53,15 @@ class ConnectionPool
end
def with(options = {})
success = false # hoisted
# Connections can become corrupted via Timeout::Error. Discard
# any connection whose usage after checkout does not finish as expected.
# See #67
success = false
conn = checkout(options)
begin
(yield conn).tap do
success = true # means the connection wasn't interrupted
end
result = yield conn
success = true # means the connection wasn't interrupted
result
ensure
if success
# everything is roses, we can safely check the connection back in