mperham / connection_pool

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

Avoid extra mutex contention #189

Closed albus522 closed 2 months ago

albus522 commented 2 months ago

NOTE: This includes the commit from #188 so I didn't have to deal with wonky rebasing.

This limits the mutex lock to interactions with the stack that are small, fast, and atomic. Moving the connection close code outside the mutex as it doesn't impact the pool.

Sidenote: Thinking about releasing the reap update, it probably needs to be a major version bump as it breaks things for anyone that has used the defined extension points and interacts with @que. It is probably possible this could be modified to only introduce a breaking change if reap is used.