From a7ae0e608071ffde05eb361bceb03f62ad5b38bd Mon Sep 17 00:00:00 2001 From: Varshith B Date: Fri, 7 Feb 2025 15:00:29 +0000 Subject: [PATCH] fix: control loop task --- runner/app/live/streamer/streamer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runner/app/live/streamer/streamer.py b/runner/app/live/streamer/streamer.py index 1956def7..8c3aeb28 100644 --- a/runner/app/live/streamer/streamer.py +++ b/runner/app/live/streamer/streamer.py @@ -47,9 +47,12 @@ async def start(self): run_in_background("ingress_loop", self.run_ingress_loop()), run_in_background("egress_loop", self.run_egress_loop()), run_in_background("monitor_loop", self.monitor_loop()), - run_in_background("control_loop", self.run_control_loop()), run_in_background("report_status_loop", self.report_status_loop()) ] + # auxiliary tasks that are not critical to the supervisor, but which we want to run + self.auxiliary_tasks = [ + run_in_background("control_loop", self.run_control_loop()) + ] self.tasks_supervisor_task = run_in_background("tasks_supervisor", self.tasks_supervisor()) async def tasks_supervisor(self): @@ -73,7 +76,7 @@ async def _do_stop(self): # make sure the stop event is set and give running tasks a chance to exit cleanly self.stop_event.set() - _, pending = await asyncio.wait(self.main_tasks, return_when=asyncio.ALL_COMPLETED, timeout=1) + _, pending = await asyncio.wait(self.main_tasks + self.auxiliary_tasks, return_when=asyncio.ALL_COMPLETED, timeout=1) # force cancellation of the remaining tasks for task in pending: task.cancel()