Skip to content

Commit 3338548

Browse files
committed
different method of suppressing exception
1 parent 791b5b0 commit 3338548

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

app/contacts/contact_tcp.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@ async def stop(self):
3232
self.op_loop_task.cancel()
3333
if self.server_task:
3434
self.server_task.cancel()
35-
try:
36-
await self.op_loop_task
37-
except asyncio.CancelledError:
38-
self.log.debug('Canceled TCP contact operation loop task.')
39-
try:
40-
await self.server_task
41-
except asyncio.CancelledError:
42-
self.log.debug('Canceled TCP contact server task.')
35+
_ = await asyncio.gather(self.op_loop_task, self.server_task, return_exceptions=True)
4336

4437
async def start_server(self, host, port):
4538
try:

0 commit comments

Comments
 (0)