Skip to content

Commit c29a3f2

Browse files
committed
Exclude current_task from gathering at close connection
to try unblocking the CI in github actions
1 parent c7bf140 commit c29a3f2

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

juju/client/connection.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,17 @@ async def close(self, to_reconnect=False):
451451
if self._ws and not self._ws.closed:
452452
await self._ws.close()
453453

454-
"""
455-
Temporarily disabling this to investigate CI blockage
456454
try:
457455
log.debug('Gathering all tasks for connection close')
458-
await jasyncio.gather(*jasyncio.all_tasks())
456+
457+
# Avoid gathering the current task
458+
tasks_need_to_be_gathered = [task for task in jasyncio.all_tasks()
459+
if task != jasyncio.current_task()]
460+
await jasyncio.gather(*tasks_need_to_be_gathered)
459461
except jasyncio.CancelledError:
460462
pass
461463
except websockets.exceptions.ConnectionClosed:
462464
pass
463-
"""
464465

465466
self._pinger_task = None
466467
self._receiver_task = None

juju/jasyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
gather, sleep, wait_for, create_subprocess_exec, subprocess, \
2222
wait, FIRST_COMPLETED, Lock, as_completed, new_event_loop, \
2323
get_event_loop_policy, CancelledError, get_running_loop, \
24-
create_task, ALL_COMPLETED, all_tasks # noqa
24+
create_task, ALL_COMPLETED, all_tasks, current_task # noqa
2525

2626

2727
def create_task_with_handler(coro, task_name, logger=ROOT_LOGGER):

0 commit comments

Comments
 (0)