You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
It's really easy to miss this and try to fire-and-forget. It would be great if flake8-async detected this.
I also wonder whether we should have an optional check which recommends using TaskGroup instead of asyncio.create_task, loop.run_until_complete, etc, but on balance think it's better to have documentation explaining why you should use anyio.TaskGroup instead (e.g. better cancellation semantics as part of structured concurrency).
The text was updated successfully, but these errors were encountered:
via Zac-HD/flake8-async-archive#5: the docs for asyncio.create_task say:
It's really easy to miss this and try to fire-and-forget. It would be great if flake8-async detected this.
I also wonder whether we should have an optional check which recommends using
TaskGroup
instead ofasyncio.create_task
,loop.run_until_complete
, etc, but on balance think it's better to have documentation explaining why you should useanyio.TaskGroup
instead (e.g. better cancellation semantics as part of structured concurrency).The text was updated successfully, but these errors were encountered: