aiomultiprocess 替换内部event loop

aiomultiprocess 可以使用其他event loop 实现

参考配置

  • Pool
import uvloop
from aiomultiprocess import Pool

async with Pool(loop_initializer=uvloop.new_event_loop) as pool:
   ...
  • Process 以及worker
import uvloop
from aiomultiprocess import Process, Worker

await Process(
    target=some_coro, loop_initializer=uvloop.new_event_loop
)
result = await Worker(
    target=other_coro, loop_initializer=uvloop.new_event_loop
)

参考资料

https://github.com/MagicStack/uvloop

posted on 2026-09-20 08:00  荣锋亮  阅读(0)  评论(0)    收藏  举报

导航