-
Notifications
You must be signed in to change notification settings - Fork 578
Restore context on listen in UVStreamServer. Fix #305 #306
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the unstable test issue, I'm okay with this PR. Thanks!
tests/test_context.py
Outdated
# Let all transports shutdown. | ||
await asyncio.sleep(0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sleep
is generally not recommended for new tests in uvloop - this test is actually unstable, I could get a false OK if the srv.close()
got called before the connection is fully established.
A proper fix is to use a Future
, set in factory()
and awaited in test()
- we could even pass over the assertion error in this manner. With this fix, the ResourceWarning
is also gone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see suggested changes below - could you please also rebase your commits to latest master so that the test suite may pass? Thanks!
This particular fix is OK, but we need to fix this for all other "native" callbacks in uvloop in a more systematic way. |
Merged in #348. Thanks for the PR! |
No description provided.