From bbc67140944b925af81048d97ad4e9ab7d79265c Mon Sep 17 00:00:00 2001 From: bai <1145000687@qq.com> Date: Thu, 13 Feb 2025 17:34:05 +0800 Subject: [PATCH] =?UTF-8?q?py:=20=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=92=8C=E9=9D=99=E9=BB=98=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socketd/socketd/transport/core/impl/ProcessorDefault.py | 2 +- python/socketd/socketd/utils/AsyncUtils.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python/socketd/socketd/transport/core/impl/ProcessorDefault.py b/python/socketd/socketd/transport/core/impl/ProcessorDefault.py index 77332ef5..45a552f2 100644 --- a/python/socketd/socketd/transport/core/impl/ProcessorDefault.py +++ b/python/socketd/socketd/transport/core/impl/ProcessorDefault.py @@ -203,7 +203,7 @@ class ProcessorDefault(Processor, FrameIoHandler, ABC): await RunUtils.waitTry(self.listener.on_reply(channel.get_session(), frame.message())) else: # 改为异步处理,避免卡死Io线程 - asyncio.get_running_loop().run_in_executor(self.get_config().get_exchange_executor(), + asyncio.get_running_loop().run_in_executor(channel.get_config().get_exchange_executor(), lambda _m: asyncio.run(stream.on_reply(_m)), frame.message()) else: await RunUtils.waitTry(self.listener.on_reply(channel.get_session(), frame.message())) diff --git a/python/socketd/socketd/utils/AsyncUtils.py b/python/socketd/socketd/utils/AsyncUtils.py index 75639ecf..7602462a 100644 --- a/python/socketd/socketd/utils/AsyncUtils.py +++ b/python/socketd/socketd/utils/AsyncUtils.py @@ -4,8 +4,9 @@ import typing from concurrent.futures import Executor from threading import Thread -if sys.platform == "win32": - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) +# 让用户自主选择 +# if sys.platform == "win32": +# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) class AsyncUtils(object): -- Gitee