12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- from hub import methods, Global
- import threading
- import time
- import json
- import os
- # --- for linux
- # save_dir = f"/home/server/logs"
- # --- for windows
- # save_dir = r'C:\SRI-DINO.Server-py\logs' # sri内网测试环境
- save_dir = r'C:\logs' # sri内网测试环境
- # last_log_key = str()
- class MessageListener(object):
- """
- """
- @classmethod
- def run(cls, background_is=True):
- from lib.UserWorkRecord import UserWorkRecord
- UserWorkRecord.init()
- from lib.MessageListenerC001 import subscribe_c001
- # from lib.MessageListenerV001 import subscribe_v001
- thread_list = [
- threading.Thread(target=subscribe_c001),
- # threading.Thread(target=subscribe_v001),
- ]
- for thread in thread_list:
- thread.setDaemon(True)
- thread.start()
- if background_is:
- return
- for thread in thread_list:
- thread.join()
- if __name__ == '__main__':
- # --- test ---
- MessageListener.run()
|