Skip to content

Commit 84d5d17

Browse files
committed
Ignore cancellederror when closing connections
1 parent a3197d0 commit 84d5d17

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

graphql_ws/base_async.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ async def on_close(self, connection_context):
159159
for op_id in connection_context.operations
160160
) + tuple(task.cancel() for task in connection_context.pending_tasks)
161161
if awaitables:
162-
await asyncio.gather(*awaitables, loop=self.loop)
162+
try:
163+
await asyncio.gather(*awaitables, loop=self.loop)
164+
except asyncio.CancelledError:
165+
pass
163166

164167
async def on_stop(self, connection_context, op_id):
165168
await self.unsubscribe(connection_context, op_id)

0 commit comments

Comments
 (0)