fix(runtime): enforce main event loop ownership (#6424)

This commit is contained in:
InfinityPacer
2026-08-23 20:14:31 +08:00
committed by GitHub
parent c72b4fe88e
commit 1d2984b95f
14 changed files with 181 additions and 55 deletions
+2 -2
View File
@@ -143,8 +143,8 @@ def _pooled_loop() -> Optional[Any]:
只认常驻主循环:它承载了绝大多数异步 DB 流量,且生命周期与进程一致,
池中连接不会因循环销毁而失效。
直接读 CURRENT_EVENT_LOOP 而不用 global_vars.loop——后者在未设置时会
新建一个事件循环,仅为判断就产生副作用是不可接受的
直接读 CURRENT_EVENT_LOOP 而不用 global_vars.loop,避免主循环尚未就绪时
把正常的回退引擎选择转换成生命周期异常
"""
if not _async_pool_enabled():
return None