Skip to content

Replace asyncio.wait_for with async-timeout #480

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

Merged
merged 4 commits into from
Jul 21, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Jul 21, 2023

Note: CI failure is fixed by #482

asyncio.wait_for has some underlying problems that are only fixed in cpython 3.12.

Use async_timeout instead until the minimum supported version is 3.11+ and it can be replaced with asyncio.timeout

See python/cpython#98518

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06 🎉

Comparison is base (9b039d8) 79.55% compared to head (f0630f5) 79.61%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
+ Coverage   79.55%   79.61%   +0.06%     
==========================================
  Files          26       26              
  Lines        1956     1962       +6     
  Branches      599      602       +3     
==========================================
+ Hits         1556     1562       +6     
  Misses        359      359              
  Partials       41       41              
Impacted Files Coverage Δ
kasa/protocol.py 86.95% <100.00%> (+0.59%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bdraco bdraco marked this pull request as ready for review July 21, 2023 02:43
bdraco added 4 commits July 21, 2023 04:18
Fallback to using async_timeout on older python

asyncio.wait_for has some underlying problems that are only fixed in
cpython 3.12. See python/cpython#98518
Fallback to using async_timeout on older python

asyncio.wait_for has some underlying problems that are only fixed in
cpython 3.12. See python/cpython#98518
Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@rytilahti rytilahti changed the title Replace asyncio.wait_for with asyncio.timeout Replace asyncio.wait_for with async-timeout Jul 21, 2023
@rytilahti rytilahti merged commit 117a7ac into python-kasa:master Jul 21, 2023
@rytilahti
Copy link
Member

How crucial it is to get this released rather sooner than later? Currently a bit busy with other things, so if a new release can wait I'd rather do it later.

@bdraco
Copy link
Member Author

bdraco commented Jul 21, 2023

It's hard to tell from the information users have provided if they have network problems or are getting hitting by races with wait_for which makes it difficult to give a good answer here.

I suspect we have both cases.

It would be great to have it released in time for beta on Wednesday.

@rytilahti
Copy link
Member

Potentially related to home-assistant/core#90636

@rytilahti rytilahti added the bug Something isn't working label Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants