Yes, I am calling HTTPServer.stop(). Below is my code, that's called from the appropriate signal handler:
def _shutdown(http_server, loop, app):
log.info("Stopping HTTPServer...")
http_server.stop()
log.info("Waiting max 10.0 secs for IOLoops to finish it's work...")
deadline = loop.time() + 10.0
_stop_all(loop, app, deadline)
def _stop_all(loop, app, deadline):
now = loop.time()
if now < deadline and (loop._callbacks or loop._timeouts):
loop.add_timeout(now + 1, \
functools.partial(_stop_all, loop, app, deadline))
else:
log.info("Closing database connection...")
app.db.close()
_flush_py_stdout()
log.info("Stopping IOLoop...")
loop.stop()
log.info("Shutdown.")
# TODO: delete the unix sockets here.
# This shutdown will be on the logging module itself (and not on 'log').
logging.shutdown()
-Ethan