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
|
end
|
||||||
|
|
||||||
def with(options = {})
|
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)
|
conn = checkout(options)
|
||||||
begin
|
begin
|
||||||
(yield conn).tap do
|
result = yield conn
|
||||||
success = true # means the connection wasn't interrupted
|
success = true # means the connection wasn't interrupted
|
||||||
end
|
result
|
||||||
ensure
|
ensure
|
||||||
if success
|
if success
|
||||||
# everything is roses, we can safely check the connection back in
|
# everything is roses, we can safely check the connection back in
|
||||||
|
|
Loading…
Reference in a new issue