0
ドキュメント(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.
ことを書かれている。しかし、私がしようとした場合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