0
文档(http://www.tornadoweb.org/en/stable/web.html#tornado.web.stream_request_body)是writen是 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.
但如果我尝试Python的龙卷风流请求体
@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不叫之前准备返回(不会产生)。为什么?
什么是long_time_operation?它内部产量还是阻塞? –
这是异步操作,调用并产生长时间的AsyncHTTPClient.fetch方法 – COUNTERKILL