From 6ef22cf578842da4a3fb88968dc076c846b93099 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 22 Feb 2020 07:36:35 -0600 Subject: [PATCH] fix watchdog --- detect_objects.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/detect_objects.py b/detect_objects.py index 17160c1a7..c544b3c8c 100644 --- a/detect_objects.py +++ b/detect_objects.py @@ -74,13 +74,12 @@ class CameraWatchdog(threading.Thread): print(f"Last frame for {name} is more than 30 seconds old...") if process.is_alive(): process.terminate() - try: - print("Waiting for process to exit gracefully...") - process.wait(timeout=30) - except sp.TimeoutExpired: + print("Waiting for process to exit gracefully...") + process.join(timeout=30) + if process.exitcode is None: print("Process didnt exit. Force killing...") process.kill() - process.wait() + process.join() if not process.is_alive(): print(f"Process for {name} is not alive. Starting again...") camera_process['fps'].value = float(self.config[name]['fps'])