Skip to content

Improve GrpcWorker shutdown #30

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

Merged
merged 2 commits into from
Jun 23, 2025
Merged

Conversation

javier-aliaga
Copy link

@javier-aliaga javier-aliaga commented Jun 19, 2025

Issue describing the changes in this PR

resolves previous TODO
Interrupt worker thread on stop

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes are added to the CHANGELOG.md
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

Signed-off-by: Javier Aliaga <javier@diagrid.io>
*/
public void start() {
new Thread(this::startAndBlock).start();
this.workerThread = new Thread(this::startAndBlock);
this.workerThread.start();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real change

@@ -39,6 +40,7 @@ public final class DurableTaskGrpcWorker implements AutoCloseable {
private final TaskHubSidecarServiceBlockingStub sidecarClient;
private final boolean isExecutorServiceManaged;
private volatile boolean isNormalShutdown = false;
private Thread workerThread;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real change

* it is the responsibility of the supplier to take care of them.
*/
public void close() {
this.workerThread.interrupt();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real change

Signed-off-by: Javier Aliaga <javier@diagrid.io>
@javier-aliaga javier-aliaga marked this pull request as ready for review June 19, 2025 11:47
Copy link
Collaborator

@cicoyle cicoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx Javi!

@cicoyle cicoyle merged commit 5094800 into dapr:main Jun 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants