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

Add support for cancelling scopes #34

Merged
merged 1 commit into from Sep 2, 2021
Merged

Add support for cancelling scopes #34

merged 1 commit into from Sep 2, 2021

Conversation

maffoo
Copy link
Collaborator

@maffoo maffoo commented Sep 1, 2021

This support is pretty basic, but seems to work. I think we'll probably make a preview release so we can iterate on the API a bit before stabilizing in a real release.

@maffoo maffoo requested a review from kunalq September 1, 2021 21:42
Copy link
Collaborator

@kunalq kunalq left a comment

Choose a reason for hiding this comment

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

LGTM! Looks great!

scope_future.set_result(scope)
await task_future

async def cancel_task():
Copy link
Collaborator

Choose a reason for hiding this comment

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

May want to start adding type annotations to these (including the test method)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Filed #35 about adding type annotations throughout the tests.

scope.spawn(main_task)
scope.spawn(cancel_task)

assert task_future.cancelled()
Copy link
Collaborator

Choose a reason for hiding this comment

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

neat test!

@maffoo maffoo merged commit 72f350e into main Sep 2, 2021
@maffoo maffoo deleted the u/maffoo/cancellation branch September 2, 2021 20:01
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.

None yet

2 participants