修复web socket满了导致后面代码无法执行bug
This commit is contained in:
@@ -445,30 +445,33 @@ class BaseFrameProcessorWorker(threading.Thread):
|
|||||||
"result_type": push_actions,
|
"result_type": push_actions,
|
||||||
"image_base64": img_b64
|
"image_base64": img_b64
|
||||||
}
|
}
|
||||||
|
# 先推送到ws队列
|
||||||
try:
|
try:
|
||||||
self.ws_queue.put(msg, timeout=1.0)
|
self.ws_queue.put(msg, timeout=1.0)
|
||||||
if push_actions and len(push_actions) > 0:
|
|
||||||
# 构建消息
|
|
||||||
post_msg = msg.copy()
|
|
||||||
post_msg['type'] = self.POST_TYPE
|
|
||||||
post_msg['ori_alert']: result_alerts
|
|
||||||
|
|
||||||
#备用backup
|
|
||||||
#self.post_executor.submit(self._post_alert, post_msg)
|
|
||||||
|
|
||||||
# 获取视频相关信息(仅HLS模式有)
|
|
||||||
segment_path = item.get("segment_path")
|
|
||||||
segment_duration = item.get("segment_duration")
|
|
||||||
|
|
||||||
# 提交到线程池执行(包含视频剪辑和POST)
|
|
||||||
self.post_executor.submit(
|
|
||||||
self._process_alert_with_video,
|
|
||||||
post_msg,
|
|
||||||
segment_path,
|
|
||||||
segment_duration
|
|
||||||
)
|
|
||||||
except queue.Full:
|
except queue.Full:
|
||||||
logger.warning("[WARN] ws_send_queue full, drop frame message")
|
logger.warning("[WARN] ws_send_queue full, drop frame message")
|
||||||
|
|
||||||
|
# 如果有告警,需要POST(即使ws队列满了也要发送)
|
||||||
|
if push_actions and len(push_actions) > 0:
|
||||||
|
# 构建消息
|
||||||
|
post_msg = msg.copy()
|
||||||
|
post_msg['type'] = self.POST_TYPE
|
||||||
|
post_msg['ori_alert'] = result_alerts
|
||||||
|
|
||||||
|
#备用backup
|
||||||
|
#self.post_executor.submit(self._post_alert, post_msg)
|
||||||
|
|
||||||
|
# 获取视频相关信息(仅HLS模式有)
|
||||||
|
segment_path = item.get("segment_path")
|
||||||
|
segment_duration = item.get("segment_duration")
|
||||||
|
|
||||||
|
# 提交到线程池执行(包含视频剪辑和POST)
|
||||||
|
self.post_executor.submit(
|
||||||
|
self._process_alert_with_video,
|
||||||
|
post_msg,
|
||||||
|
segment_path,
|
||||||
|
segment_duration
|
||||||
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|||||||
Reference in New Issue
Block a user