admin
2023-08-04 ca310f014336d93eba73ed5010c1c5645424a1e0
command_manager.py
@@ -88,6 +88,7 @@
        # 发送心跳
        cls.__heartbeats_thread(type, key, sk)
        cls.__listen_command_thread(type, key, sk)
        print("create_and_run_client success",type,key)
        return key, sk
    @classmethod
@@ -162,6 +163,7 @@
                if _type == CLIENT_TYPE_TRADE:
                    if client_id in cls.trade_client_dict:
                        cls.trade_client_dict.pop(client_id)
                        print("pop trade client", client_id)
                elif _type == CLIENT_TYPE_MONEY:
                    cls.money_client = None
                elif _type == CLIENT_TYPE_DEAL_LIST:
@@ -185,7 +187,7 @@
                    json.dumps({"type": "heart", "client_id": client_id}).encode('utf-8')))
                # print("心跳信息发送成功", client_id)
            except Exception as e:
                print("心跳信息发送失败")
                print("心跳信息发送失败",_type,client_id)
                logging.exception(e)
                if _type == CLIENT_TYPE_TRADE:
                    if client_id in cls.trade_client_dict:
@@ -223,7 +225,7 @@
        while True:
            try:
                if len(cls.trade_client_dict) < cls.trade_client_count:
                    print("__maintain_client", CLIENT_TYPE_TRADE)
                    print("__maintain_client", CLIENT_TYPE_TRADE, cls.trade_client_count - len(cls.trade_client_dict))
                    for i in range(cls.trade_client_count - len(cls.trade_client_dict)):
                        result = cls.__create_and_run_client(CLIENT_TYPE_TRADE)
                        cls.trade_client_dict[result[0]] = result[1]