Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: control loop task #416

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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