小编Lvx*_*uan的帖子

龙卷风,使 on_finish() 异步

覆盖方法 on_finish()。装饰此方法.gen.coroutine以使其异步,它起作用了。

@gen.coroutine
def on_finish(self):
    print("==========on_finish==============")
Run Code Online (Sandbox Code Playgroud)

但使用async def使其异步,它失败了。

async def on_finish(self):
    print("==========on_finish==============")

# RuntimeWarning: coroutine 'BaseHandler.on_finish' was never awaited
Run Code Online (Sandbox Code Playgroud)

self.on_finish()

为什么我不能async def用来使它异步?

asynchronous tornado coroutine

4
推荐指数
1
解决办法
531
查看次数

标签 统计

asynchronous ×1

coroutine ×1

tornado ×1