-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Milestone
Description
Background
When managing dynamic resources (e.g., network connections, client instances) with syncx.Pool, there's currently no built-in way to proactively destroy all resources in the pool when it's no longer needed.
The existing maxAge mechanism only passively cleans up expired resources, which isn't sufficient for scenarios like:
- Removing an obsolete pool (e.g., when a target service goes offline)
- Forcefully refreshing all resources in the pool (e.g., after configuration changes)
- Avoiding resource leaks when pools are dynamically replaced in a map
Proposal
Add a destroyAll() method to syncx.Pool
Use Case Example
In industrial communication scenarios (e.g., Modbus client pools), when a device's address changes, we need to immediately clean up the old pool's connections. A destroyAll() method would make this safe and straightforward.
Copilot