tornado equivalent of delay

后端 未结 3 2029
無奈伤痛
無奈伤痛 2020-12-29 07:24

Is there an equivalent command in tornado for delay function without affecting the main process to sleep (thus the callbacks would execute even when the main thread is dealy

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 08:08

    Note that since 4.1 they've added a gen.sleep(delay) method.

    so

    yield gen.Task(IOLoop.instance().add_timeout, time.time() + 5)
    

    would just become

    yield gen.sleep(5)
    

提交回复
热议问题