Skip to content

Commit

Permalink
Fail ISAR if any sub-thread fails
Browse files Browse the repository at this point in the history
The previous method would join the first thread in threads and then block for that thread.
If that thread failed, then it would simply join the next thread, and if another thread failed,
it would do nothing.

This fixes that.
  • Loading branch information
GodVenn committed Mar 8, 2023
1 parent 745aac0 commit 059dfb6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import time
from logging import Logger
from threading import Thread
from typing import List
Expand Down Expand Up @@ -94,6 +95,9 @@
thread.start()
logger.info(f"Started thread: {thread.name}")

for thread in threads:
thread.join()
logger.info(f"Joined thread: {thread.name}")
while True:
for thread in threads:
if not thread.is_alive():
logger.critical("Thread '%s' failed - ISAR shutting down", thread.name)
exit(1)
time.sleep(state_machine.sleep_time)

0 comments on commit 059dfb6

Please sign in to comment.