Skip to content

Commit 62ac8a7

Browse files
committed
Only gather the pinger and receiver tasks at the teardown
1 parent 4130661 commit 62ac8a7

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

juju/client/connection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,7 @@ async def close(self, to_reconnect=False):
456456
if not to_reconnect:
457457
try:
458458
log.debug('Gathering all tasks for connection close')
459-
460-
# Avoid gathering the current task
461-
tasks_need_to_be_gathered = [task for task in jasyncio.all_tasks() if task != jasyncio.current_task()]
459+
tasks_need_to_be_gathered = [self._receiver_task, self._pinger_task]
462460
await jasyncio.gather(*tasks_need_to_be_gathered)
463461
except jasyncio.CancelledError:
464462
pass

0 commit comments

Comments
 (0)