Python 龙卷风流请求正文
Python tornado stream request body
文档 (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 在准备 returns 之前不要调用(不让步)。为什么?
似乎文档有误,我已经提交了一个错误。
文档 (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 在准备 returns 之前不要调用(不让步)。为什么?
似乎文档有误,我已经提交了一个错误。