From dbc2ec056e478704cc352586a22e9e07755b15f0 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 25 八月 2023 15:33:34 +0800
Subject: [PATCH] 共享内存测试

---
 huaxin_client/command_manager.py |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/huaxin_client/command_manager.py b/huaxin_client/command_manager.py
index 4939098..8888f09 100644
--- a/huaxin_client/command_manager.py
+++ b/huaxin_client/command_manager.py
@@ -78,7 +78,7 @@
         cls.pipe_l2 = pipe_l2
 
     @classmethod
-    def __process_command(cls, _type, client_id, result_json):
+    def process_command(cls, _type, client_id, result_json):
         try:
             data = result_json["data"]
             print("鎺ユ敹鍐呭", result_json)
@@ -106,7 +106,7 @@
             elif _type == "test":
                 cls.action_callback.OnTest(client_id, request_id, data)
         except Exception as e:
-            logger_local_huaxin_trade_debug.debug(f"__process_command鍑洪敊锛歿result_json}")
+            logger_local_huaxin_trade_debug.debug(f"process_command鍑洪敊锛歿result_json}")
             logging.exception(e)
             logging.error(result_json)
 
@@ -115,23 +115,26 @@
         if pipe_strategy is None:
             return
         # 鏈湴鍛戒护鎺ユ敹
-        while True:
-            try:
-                val = pipe_strategy.recv()
-                if val:
-                    val = json.loads(val)
-                    print("run_process_command", val)
-                    _type = val["type"]
-                    _data = val["data"]
-                    # 鏌ョ湅鏄惁鏄缃甃2鐨勪唬鐮�
-                    if _type == CLIENT_TYPE_CMD_L2:
-                        cls.pipe_l2.send(
-                            json.dumps({"type": "set_l2_codes", "data": _data}))
-                    else:
-                        threading.Thread(target=lambda: cls.__process_command(_type, None, val), daemon=True).start()
-            except Exception as e:
-                logger_local_huaxin_trade_debug.exception(e)
-                logging.exception(e)
+        try:
+            while True:
+                try:
+                    val = pipe_strategy.recv()
+                    if val:
+                        val = json.loads(val)
+                        print("run_process_command", val)
+                        _type = val["type"]
+                        _data = val["data"]
+                        # 鏌ョ湅鏄惁鏄缃甃2鐨勪唬鐮�
+                        if _type == CLIENT_TYPE_CMD_L2:
+                            cls.pipe_l2.send(
+                                json.dumps({"type": "set_l2_codes", "data": _data}))
+                        else:
+                            threading.Thread(target=lambda: cls.process_command(_type, None, val), daemon=True).start()
+                except Exception as e:
+                    logger_local_huaxin_trade_debug.exception(e)
+                    logging.exception(e)
+        except Exception as e:
+            logger_local_huaxin_trade_debug.exception(e)
 
     # 缁存姢杩炴帴鏁扮殑绋冲畾
     def run(self, blocking=True):

--
Gitblit v1.8.0