Opened 6 months ago
Last modified 6 months ago
#36315 assigned Cleanup/optimization
Use task groups/cancel scopes where possible
Reported by: | Thomas Grainger | Owned by: | Thomas Grainger |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | async |
Cc: | Carlton Gibson | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
eg replace asyncio.create_task with a Task Group
replace wait_for/wait with Timeout/CancelScope
create a function for asyncio.gather that uses a Task Group
This could use anyio.create_task_group and anyio.CancelScope, but now there's 3.11 asyncio.TaskGroup and asyncio.Timeout are available.
Obviously I'm biased and think the anyio versions are a better choice, but it's easier to add asyncio.TaskGroup/Timeout and worry about trio support in the 'future'.
Change History (4)
comment:1 by , 6 months ago
Description: | modified (diff) |
---|---|
Owner: | set to |
comment:2 by , 6 months ago
Has patch: | set |
---|
comment:3 by , 6 months ago
Cc: | added |
---|---|
Component: | Uncategorized → HTTP handling |
Keywords: | async added |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:4 by , 6 months ago
Summary: | use task groups/cancel scopes where possible → Use task groups/cancel scopes where possible |
---|
Note:
See TracTickets
for help on using tickets.
Yes, this seems like a nice modernisation. Thanks.