What state does self.finish() put the tornado web server in?
python, tornado
Solution
`self.finish()` doesn't set any status. This function finish generating the response package and put the package to write_buffer(in which the package chunk will be sent to client by tornado)
There is no need for you to call self.finish at the end of every request handler. Some return methods such as self.redirect() or self.render() do the finish work by themselves. But when you use the decorator `@web.asynchronous` to delay a response, you must call self.finish() at the end. Here is the demo of `@web.asynchronous` http://www.tornadoweb.org/en/stable/web.html?highlight=asynchronous#tornado.web.asynchronous
Problem
What state does self.finish() put the `torando` web server in? I assume it closes the current connection. Currently I'm using `self.set_status(204)` to return a HTTP response code but I am not calling `self.finish()`, should I be calling it at the end of every request handler?