文档(http://www.tornadoweb.org/en/stable/web.html#tornado.web.stream_request_body)正在写入
There is a subtle interaction between data_received and asynchronous prepare: The first call to data_received may occur at any point after the call to prepare has returned or yielded.
但是,如果我尝试
@tornado.web.stream_request_body
class HTTPHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def prepare(self):
yield long_time_operation()
@tornado.gen.coroutine
def data_received(self, chunk):
print("Data received")
data_received在prepare返回之前不调用(不是yield)。为什么呢?