bachya / aioambient

🌤 A clean, async-friendly library for interacting with the Ambient Weather API
MIT License
33 stars 10 forks source link

Fire and forget task does not hold a strong reference #486

Open bdraco opened 7 months ago

bdraco commented 7 months ago

https://github.com/bachya/aioambient/blob/779c296d9ceef42756b7ee90ad9375e5bd82d384/aioambient/websocket.py#L66

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:

github-actions[bot] commented 6 months ago

There hasn't been any activity on this issue recently, so it has been marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment. This issue will be closed if no further activity occurs. Thanks!

bdraco commented 6 months ago

Keep alive

bachya commented 6 months ago

Thanks, @bdraco—been slammed at work, so haven't had a chance to look at this, but will soon.

bdraco commented 6 months ago

No worries. This one is low priority