mperham / connection_pool

Generic connection pooling for Ruby
MIT License
1.63k stars 143 forks source link

ensure reap does not enter infinite loop #193

Closed ttstarck closed 2 months ago

ttstarck commented 2 months ago

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.