Skip to content

Feature Request: Add destroyAll() method to syncx.Pool #5191

@maomao94

Description

@maomao94

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:

  1. Removing an obsolete pool (e.g., when a target service goes offline)
  2. Forcefully refreshing all resources in the pool (e.g., after configuration changes)
  3. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions