@tornado.web.asynchronous
prevents the the RequestHandler
from automatically calling self.finish()
. That's it; it just means Tornado will keep the connection open until you manually call self.finish()
.
Code not using this decorator can block, or not. Using the decorator doesn't change that in any way.
As @Steve Peak said, you use the decorator for asynchronous requests, e.g. database retrieval.
Updated for Tornado 3.1+: If you use @gen.coroutine
, you don't need to use @asynchronous
as well. The older @gen.engine
interface still requires @asynchronous
, I believe.