浏览代码

ensure detection_start doesnt change values between conditions

Blake Blackshear 5 年之前
父节点
当前提交
7d33e03943
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      detect_objects.py

+ 3 - 2
detect_objects.py

@@ -92,8 +92,9 @@ class CameraWatchdog(threading.Thread):
                 self.plasma_process = start_plasma_store()
 
             # check the detection process
-            if (self.tflite_process.detection_start.value > 0.0 and 
-                datetime.datetime.now().timestamp() - self.tflite_process.detection_start.value > 10):
+            detection_start = self.tflite_process.detection_start.value
+            if (detection_start > 0.0 and 
+                datetime.datetime.now().timestamp() - detection_start > 10):
                 print("Detection appears to be stuck. Restarting detection process")
                 self.tflite_process.start_or_restart()
             elif not self.tflite_process.detect_process.is_alive():