algSwitch-flag

This commit is contained in:
jiangchaoqing 2025-05-26 09:33:46 +08:00
parent d43559e72c
commit 7f85fab1d8
3 changed files with 34 additions and 1 deletions

View File

@ -27,6 +27,18 @@ class FileUpload(Thread):
self._storage_source = self._context['service']['storage_source']
self._algStatus = False # 默认关闭
self._algSwitch = self._context['service']['algSwitch']
# for algswitch flag:
default_enabled = str(self._msg.get("defaultEnabled","True")).lower() == "true"
if default_enabled:
self._algSwitch= True
else:
self._algSwitch= False
#如果任务是在线、离线处理,则用此类
class ImageFileUpload(FileUpload):
__slots__ = ()

View File

@ -36,7 +36,17 @@ class PushStreamProcess(Process):
# 传参
self._msg, self._push_queue, self._image_queue, self._push_ex_queue, self._hb_queue, self._context = args
self._algStatus = False # 默认关闭
self._algSwitch = self._context['service']['algSwitch']
self._algSwitch = self._context['service']['algSwitch']
# for algswitch flag:
default_enabled = str(self._msg.get("defaultEnabled","True")).lower() == "true"
if default_enabled:
self._algSwitch= True
else:
self._algSwitch= False
def build_logo_url(self):
logo = None

View File

@ -244,6 +244,17 @@ class DispatcherService:
# 开启实时进程
def startOnlineProcess(self, msg, analysisType):
# for algswitch flag:
default_enabled = str(msg.get("defaultEnabled","True")).lower() == "true"
if default_enabled:
self.__context['service']['algSwitch'] = True
else:
self.__context['service']['algSwitch'] = False
if self.__listeningProcesses.get(msg["request_id"]):
logger.warning("实时重复任务请稍后再试requestId:{}", msg["request_id"])
return