Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the JobWorker disposing #769

Open
xlegalles opened this issue Feb 10, 2025 · 0 comments
Open

Improve the JobWorker disposing #769

xlegalles opened this issue Feb 10, 2025 · 0 comments
Labels

Comments

@xlegalles
Copy link
Contributor

xlegalles commented Feb 10, 2025

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:

  1. Implement a new async Stop() method
  2. 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

@xlegalles xlegalles changed the title Improve the client disposing Improve the JobWorker disposing Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant