Disposes of a client session and all related resources within a swarm.
This function terminates a client session, cleaning up associated swarm, agent, storage, state, and auxiliary resources (e.g., history, logs, performance metrics).
It ensures that all dependencies are properly disposed of to prevent resource leaks, using sets to avoid redundant disposal of shared resources.
The execution is wrapped in beginContext to ensure it runs outside of existing method and execution contexts, providing a clean execution environment.
The function logs the operation if enabled and resolves when all disposal tasks are complete.
Throws
If session or swarm validation fails, or if any disposal operation encounters an error.
Disposes of a client session and all related resources within a swarm.
This function terminates a client session, cleaning up associated swarm, agent, storage, state, and auxiliary resources (e.g., history, logs, performance metrics). It ensures that all dependencies are properly disposed of to prevent resource leaks, using sets to avoid redundant disposal of shared resources. The execution is wrapped in
beginContext
to ensure it runs outside of existing method and execution contexts, providing a clean execution environment. The function logs the operation if enabled and resolves when all disposal tasks are complete.Throws
If session or swarm validation fails, or if any disposal operation encounters an error.
Example