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: forward cancelled tasks to the inner task #1236

Merged
merged 2 commits into from Apr 7, 2022

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Apr 4, 2022

Fixes #1210

Imagine Page.waitForSelector, if a user cancels one of these api calls, the internal protocol calls are still pending and don't get canceled. When one of these errors out it setts the exception and it ends up in 'Future exception was never retrieved' (asyncio warning). I thought about two ways so far of fixing it:

a) if the outer task gets canceled "propagate" the canceled signal down to the protocol api call, see here for an impl: 2f8041c
b) store the "outer task" inside the ProtocolCallback class and check when receiving the error if it was canceled: https://github.com/microsoft/playwright-python/pull/1236/files

Not sure whats better! b) is definitely less code.

The failing lint is unrelated, it gets fixed in #1237.

@mxschmitt mxschmitt force-pushed the fix-forward-cancel branch 5 times, most recently from 47dbae1 to 2c998a1 Compare Apr 4, 2022
@mxschmitt mxschmitt merged commit bfb2869 into microsoft:main Apr 7, 2022
38 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