You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to request a new feature that allows us to immediately stop workers/isolates and cancel any in-progress calls. Currently, when we attempt to shut down a worker, it completes its ongoing tasks before actually exiting. This creates situations where we cannot quickly recover or free up resources, particularly in scenarios where graceful shutdowns are not desirable or feasible.
Use Case:
Handling error states or timeouts where hanging processes need to be forcibly terminated.
When a system or service needs to be quickly restarted or reconfigured.
Improving system responsiveness and reliability by ensuring that stuck or long-running operations don’t hold up critical resources.
Proposed Behavior:
Introduce a method (e.g., forceStopWorkers() or shutdownImmediately()) that:
Terminates worker/isolates without waiting for ongoing calls to complete.
Cancels any currently executing calls, ensuring that no callbacks or promise resolutions occur after termination.
Returns a status or error code indicating that the termination was forced.
The text was updated successfully, but these errors were encountered:
This is something that can already be done via the PlatformThreadHook callback. With this callback, you can capture the thread (Isolate or Web Worker) so you can decide to kill it (Isolate.kill() or Worker.terminate()). You'll need a bit of conditional imports if you need both platforms but you can already manage it. You should stop the worker beforehand, to make sure Squadron knows the worker cannot be used anymore.
But it's an interesting feature request, I'll keep that in mind for a future release :-)
Just one remark however, in the case of your example: I'm not quite sure what would happen... final message = await worker.hello(); might never complete. So yes, probably better to wait for a proper implementation in Squadron.
I would like to request a new feature that allows us to immediately stop workers/isolates and cancel any in-progress calls. Currently, when we attempt to shut down a worker, it completes its ongoing tasks before actually exiting. This creates situations where we cannot quickly recover or free up resources, particularly in scenarios where graceful shutdowns are not desirable or feasible.
Use Case:
Proposed Behavior:
Introduce a method (e.g., forceStopWorkers() or shutdownImmediately()) that:
The text was updated successfully, but these errors were encountered: