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:
parent
e1e3934350
commit
1e32fd797b
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue