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

Ensure we hold strong references to tasks #382

Merged
merged 5 commits into from
Feb 13, 2023
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Feb 13, 2023

https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task

Important Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done. For reliable “fire-and-forget” background tasks, gather them in a collection:

see python/cpython#88831

bdraco added a commit to bdraco/home-assistant that referenced this pull request Feb 13, 2023
We probably need to include esphome/aioesphomeapi#382
as well in another bump
aioesphomeapi/connection.py Outdated Show resolved Hide resolved
@bdraco bdraco marked this pull request as ready for review February 13, 2023 00:41
@jesserockz jesserockz merged commit 0656b65 into main Feb 13, 2023
@jesserockz jesserockz deleted the strong_ref_tasks branch February 13, 2023 01:11
balloob pushed a commit to home-assistant/core that referenced this pull request Feb 13, 2023
* Bump aioesphomeapi to 13.3.0

We probably need to include esphome/aioesphomeapi#382
as well in another bump

* bump
balloob pushed a commit to home-assistant/core that referenced this pull request Feb 13, 2023
* Bump aioesphomeapi to 13.3.0

We probably need to include esphome/aioesphomeapi#382
as well in another bump

* bump
AlePerla pushed a commit to AlePerla/homeassistant_core that referenced this pull request Feb 17, 2023
* Bump aioesphomeapi to 13.3.0

We probably need to include esphome/aioesphomeapi#382
as well in another bump

* bump
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