From feac7d0e33623092770f31316edd2dc544c0a5b3 Mon Sep 17 00:00:00 2001 From: RA Date: Wed, 22 Mar 2023 00:17:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E7=9A=84type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 8398fdd..7b9f792 100644 --- a/app.py +++ b/app.py @@ -6,6 +6,7 @@ from common import log import os from multiprocessing import Pool + def startProcess(channel_type): # load config config.load_config() @@ -14,9 +15,11 @@ def startProcess(channel_type): # startup channel channel.startup() + def wrapper(channel_type): startProcess(channel_type) + if __name__ == '__main__': try: # load config @@ -29,10 +32,12 @@ if __name__ == '__main__': model_type = config.conf().get("model").get("type") channel_type = config.conf().get("channel").get("type") + if isinstance(channel_type, list) == False: # 兼容字符串格式的type + channel_type = [channel_type] # 使用主进程启动终端通道 if "terminal" in channel_type: - index=channel_type.index("terminal") + index = channel_type.index("terminal") terminal = channel_type.pop(index) else: terminal = None @@ -50,4 +55,4 @@ if __name__ == '__main__': pool.join() except Exception as e: log.error("App startup failed!") - log.exception(e) \ No newline at end of file + log.exception(e)