node-pool icon indicating copy to clipboard operation
node-pool copied to clipboard

Suggestion on softEvictConnections

Open terryzhan0211 opened this issue 2 years ago • 0 comments

Hi, I want to implement a "soft evict" in my code, similar to how it's implemented in HikariCP: https://javadoc.io/doc/com.zaxxer/HikariCP/latest/com/zaxxer/hikari/HikariPoolMXBean.html#softEvictConnections() https://github.com/brettwooldridge/HikariCP/blob/dev/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L364. It involves evicting currently idle connections from the pool and marking active (in-use) connections for eviction when they are returned to the pool. Currently, I have my own custom implementation where I iterate through the set that stores all connections in the pool. However, the set _allObjects, which stores all connections, is currently a private variable and has not been exported and thus requires 'as any' to use in typescript. It works but as this logic should ideally be implemented at the pool level, can we expect an official API to be added in a future release, or perhaps consider exporting the allObjects set? I would appreciate any suggestions you may have. Thanks for creating this library!

terryzhan0211 avatar Jul 08 '23 00:07 terryzhan0211