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

Call ShutdownWorker API on worker shutdown #843

Merged
merged 10 commits into from
Nov 19, 2024

Conversation

yuandrew
Copy link
Contributor

What was changed

Added a new call to ShutdownWorker that was recently implemented in the server.

Why?

New server feature already implemented in Go and Java, implementing in core to match.

Checklist

  1. Closes [Feature Request] Call ShutdownWorker API on worker shutdown #822

  2. How was this tested:

Add tests to verify when API is called

@yuandrew yuandrew requested a review from a team as a code owner November 18, 2024 22:30
Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

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

Just a few minor things

Comment on lines 403 to 404
#[tokio::test]
async fn worker_shutdown_non_sticky() {
Copy link
Member

Choose a reason for hiding this comment

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

All three of these tests share a lot of code and could be combined using the rstest macro - check out the other places that's used to get an idea of how to do it.

@@ -470,6 +470,11 @@ impl Worker {
/// completed
async fn shutdown(&self) {
self.initiate_shutdown();
// Call shutdownWorker API to initiate server side shutdown
Copy link
Member

Choose a reason for hiding this comment

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

Can just get rid of this comment. Comments of the form "I'm about to do X" followed by a very easily-read "X" are usually unnecessary.

@@ -30,7 +31,7 @@ uuid = { version = "1.1", features = ["v4"], optional = true }

[build-dependencies]
tonic-build = { workspace = true }
prost-build = "0.13"
prost-build = "0.11.7"
Copy link
Member

Choose a reason for hiding this comment

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

Why did this roll back?

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

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

Sweet, thanks!

Comment on lines 506 to 507
// This is a best effort call and we can still shutdown the worker if it fails
let _ = self.client.shutdown_worker(name).await;
Copy link
Member

@cretz cretz Nov 19, 2024

Choose a reason for hiding this comment

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

I think we should warn if this is any Err except Unavailable (maybe dbg_panic too). Otherwise this is the type of thing that will just stop working and we'll never know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point!

@yuandrew yuandrew merged commit dd37e29 into temporalio:master Nov 19, 2024
6 checks passed
@yuandrew yuandrew deleted the shutdown-worker-api branch November 19, 2024 17:58
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.

[Feature Request] Call ShutdownWorker API on worker shutdown
3 participants