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
Move from asyncio.gather to asyncio.TaskGroup in WebSocketProxy.__call__.
Pitch
asyncio.TaskGroup (only available wih Python >= 3.11) has a more structured cancellation logic and (as stated from python docs) it should be preferred over asyncio.gather when there are no reasons to use one of the two over the other.
Important: this will require for the next release to drop support for Python < 3.11
Entering websockets.connect in the taskgroup context ensures that if any failure with target occurs, our child tasks (and the partent too) would properly cancel.
The text was updated successfully, but these errors were encountered:
Feature or Enhancement
Move from
asyncio.gather
toasyncio.TaskGroup
inWebSocketProxy.__call__
.Pitch
asyncio.TaskGroup
(only available wih Python >= 3.11) has a more structured cancellation logic and (as stated from python docs) it should be preferred overasyncio.gather
when there are no reasons to use one of the two over the other.Actually, the implementation is:
With
asyncio.TaskGroup
it'd be like:Entering
websockets.connect
in the taskgroup context ensures that if any failure withtarget
occurs, our child tasks (and the partent too) would properly cancel.The text was updated successfully, but these errors were encountered: