Skip to content

Commit

Permalink
fix: control loop task (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith15 authored Feb 7, 2025
1 parent 4b1d20c commit 4050a3b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runner/app/live/streamer/streamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit 4050a3b

Please sign in to comment.