【发布时间】:2017-07-08 14:39:19
【问题描述】:
你可以看到完整的here。
我的代码的简化版本如下:
executor = ProcessPoolExecutor(10)
try:
coro = bot.loop.run_in_executor(executor, processUserInput, userInput)
result = await asyncio.wait_for(coro, timeout=10.0, loop=bot.loop)
except asyncio.TimeoutError:
result="Operation took longer than 10 seconds. Aborted."
不幸的是,当操作超时时,该进程仍在运行,即使未来已被取消。如何取消该进程/任务以使其真正停止运行?
【问题讨论】:
标签: python python-multiprocessing python-asyncio