소스 검색

fix watchdog

Blake Blackshear 5 년 전
부모
커밋
6ef22cf578
1개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 5
      detect_objects.py

+ 4 - 5
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'])