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

Fixes cancelOnGracefulShutdown issue (#135) #136

Merged

Conversation

sliemeobn
Copy link
Contributor

@sliemeobn sliemeobn commented May 7, 2023

fix for #135

Motivation:

  • cancelOnGracefulShutdown was getting stuck on macOS

Modifications:

  • added explicit group.cancelAll() to all execution paths

Motivation:
+ cancelOnGracefulShutdown was getting stuck on macOS

Modifications:
+ added explicit group.cancelAll() to all execution paths
@FranzBusch
Copy link
Contributor

@swift-server-bot add to allowlist

Copy link
Contributor

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

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

Good catch. Thanks for fixing this!

@FranzBusch FranzBusch merged commit 5074896 into swift-server:main May 11, 2023
@FranzBusch FranzBusch added the 🔨 semver/patch No public API change. label May 11, 2023
@@ -80,12 +80,12 @@ public func cancelOnGracefulShutdown<T>(_ operation: @Sendable @escaping () asyn
}

let result = try await group.next()
group.cancelAll() // currently needed, as the group does not always auto-cancel tasks on return
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm the comment seems a bit off, this is not accidental the group just waits, there's no implicit cancel at end of it.

Code looks good, just rephrase the comment?

cc @FranzBusch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh my, totally my fault, thanks for addressing this! I was already feeling bad about spreading misinformation in the github issue.

I was confusing the cancelAll behavior with this for whatever reason (pretty wild in hindsight how I could mix these up). ...oh the shame... ; )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

may I offer a PR for the fix:
#137

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix!

Yeah I don't blame you, there's a lot of behavior to keep in your head smetimes with these... thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants