With the changes in https://github.com/mperham/connection_pool/pull/189 , it is possible when calling TimedStack#reap with a very low value (like 0) to enter an infinite loop, if while we are attempting to close the connection, another connection is put back on the stack.
We should ensure that when reap is called, we at most only attempt to reap the number of connections at the time that were idle.
With the changes in https://github.com/mperham/connection_pool/pull/189 , it is possible when calling
TimedStack#reap
with a very low value (like 0) to enter an infinite loop, if while we are attempting to close the connection, another connection is put back on the stack.We should ensure that when
reap
is called, we at most only attempt to reap the number of connections at the time that were idle.