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

Fix issue with task cancellation in Async(Throwing)?Stream initializers #42

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

t-sakhuja
Copy link
Contributor

Asynchrone's custom initializers for AsyncStream and AsyncThrowingStream spawn a new task to wrap the async build block, but do not handling cancelling that task when the AsyncStream is cancelled.

This resulted in situations where cancellation was failing to propagate to the build block.

The fix is to use the continuations onTermination block to cancel the newly-spawned task.

…zers

Asynchrone's custom initializers for `AsyncStream` and `AsyncThrowingStream` were spawning a new task to wrap the async `build` block, but was not handling canceling that task whenthe `AsyncStream` was cancelled.

This resulted in situations where cancellation was failing to propagate to the build block.

The fix is to use the `continuation`s `onTermination` block to cancel the newly-spawned task.
Copy link
Owner

@reddavis reddavis left a comment

Choose a reason for hiding this comment

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

Ah! Good find. Thankyou!

@reddavis reddavis merged commit a1e2ece into reddavis:main Sep 23, 2022
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