fix: EasyOCR超时也计入连续失败计数 - 防止超时跳过绕过杀进程逻辑
问题:连续3次EasyOCR超时未触发杀进程,因为'超时跳过'日志未增加失败计数器 根因:只在_q.get()返回None时增加计数器,线程超时is_alive()检查未增加计数器 修复:EasyOCR线程超时时也增加_easyocr_consecutive_failures,达到阈值触发杀进程
This commit is contained in:
+12
@@ -1932,6 +1932,18 @@ class MessageMonitor:
|
||||
logger.warning(f"[{platform}] Windows OCR 超时({_OCR_TIMEOUT}s)线程存活,跳过")
|
||||
if _t_easy.is_alive():
|
||||
logger.warning(f"[{platform}] EasyOCR 超时({_OCR_TIMEOUT}s)线程存活,跳过")
|
||||
# ⭐ EasyOCR线程超时也计入连续失败,防止"超时跳过"绕过杀进程逻辑
|
||||
self._easyocr_consecutive_failures += 1
|
||||
if self._easyocr_consecutive_failures >= self._easyocr_max_failures:
|
||||
logger.warning(f"[{platform}] EasyOCR 连续{self._easyocr_consecutive_failures}次超时,杀子进程重来")
|
||||
try:
|
||||
if self._easyocr_proc and self._easyocr_proc.poll() is None:
|
||||
self._easyocr_proc.kill()
|
||||
except Exception:
|
||||
pass
|
||||
self._easyocr_proc = None
|
||||
self._easyocr_consecutive_failures = 0
|
||||
self._easyocr_consecutive_startup_failures = 0
|
||||
|
||||
wt = win_text[0]
|
||||
et = easy_text[0]
|
||||
|
||||
Reference in New Issue
Block a user