Bubbles
1 points · 8 days ago · 0 comments

TL;DR; Python’s asyncio.create_task() can silently garbage collect your fire-and-forget tasks starting in Python 3.12 - they may never run. The fix: store task references in a set and register a done_callback to clean them up. Do you use Python’s async/await in programming? Often you have some async task that needs to run, but you don’t care to monitor it, know when it’s done, or even if it errors. Let’s imagine you have an async function that logs to a remote service. You want its executio...

No comments yet. Log in to discuss on the Fediverse