测试线程发送。防止阻塞

This commit is contained in:
liuwei
2025-05-30 09:23:59 +08:00
parent 2ee9b211c6
commit ad1b7eff67

View File

@@ -26,8 +26,11 @@ def send_message_in_thread(func, *args, **kwargs):
# 发送完成后停止事件循环
loop.stop()
# 创建并运行任务,不等待结果
# 创建并运行任务
asyncio.run_coroutine_threadsafe(send(), loop)
# 运行事件循环直到停止
loop.run_forever()
except Exception as e:
logger.error(f"线程执行失败: {e}")