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

Switch usage of asyncio.wait_for to async_timeout #337

Merged
merged 2 commits into from
Sep 1, 2023

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Aug 31, 2023

asyncio.wait_for creates another tasks which leads to some race conditions in cancelation and a performance hit

cpython 3.12 will change the underlying implementation of asyncio.wait_for to use asyncio.wait but that is still a long way off for many people:

python/cpython#98518

seen on profile courtesy of @Madelena

wait_for

`asyncio.wait_for` creates another tasks which leads to some race conditions in cancelation and a performance hit

cpython 3.12 will change the underlying implementation of `asyncio.wait_for` to use `asyncio.wait` but that is still a long way off for many people:

python/cpython#98518
@bdraco bdraco marked this pull request as ready for review August 31, 2023 13:14
@bdraco
Copy link
Contributor Author

bdraco commented Aug 31, 2023

I don't have an androidtv device though so I can't test this. I'm fixing this as a result of investigating a sluggish Home Assistant instance from the provided profile data above.

@JeffLIrion
Copy link
Owner

Thanks! I made the same change in adb-shell: JeffLIrion/adb_shell#222

@JeffLIrion JeffLIrion merged commit a7b1e51 into JeffLIrion:master Sep 1, 2023
4 checks passed
@bdraco bdraco deleted the wait_for branch September 1, 2023 18:13
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