-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Is your feature request related to a problem? Please describe.
The current Dispose() method stops the worker from polling jobs. But the current implementation uses a background task and does not wait for its termination to return. As a result, it is difficult to know when the worker is effectively stopped.
Our use case is the management of the Docker container termination: when we receive the SIGTERM, we must 1st stop the worker from polling, then wait for all current tasks to finish.
Describe the solution you'd like
We need a clear async method that stops the IJobWorker.
Describe alternatives you've considered
I propose 2 equivalent solutions:
- Implement a new async Stop() method
- Or better, implement the System.IAsyncDisposable
In both cases, the current Dispose() method would call the new async one just to not break the existing behavior.
We may consider marking the Dispose() method as obsolete and remove it later