def stop_server(): global httpserver for c in WSHandler.clients.copy(): c.close() WSHandler.clients.clear() if httpserver: logger.info('Stopping server') httpserver.stop() tornado.ioloop.IOLoop.instance().stop()
def stop(): global httpserver for c in WSHandler.clients.copy(): c.close() WSHandler.clients.clear() if httpserver: logger.info('Stopping server') httpserver.stop() tornado.ioloop.IOLoop.instance().stop()
def stop(): for c in clients.copy(): c.close() clients.clear() patchers.clear() editors.clear() global httpserver if httpserver: logger.info('Stopping server') httpserver.stop() httpserver = None
def shutdown(): logging.info("Stopping HttpServer...") httpserver.stop() # No longer accept new http traffic logging.info("IOLoop Will be Terminate in %s Seconds...", MAX_WAIT_SECONDS_BEFORE_SHUTDOWN) instance = tornado.ioloop.IOLoop.instance() deadline = time.time() + MAX_WAIT_SECONDS_BEFORE_SHUTDOWN # recursion for terminate IOLoop.instance() def terminate(): now = time.time() if now < deadline and (instance._callbacks or instance._timeouts): instance.add_timeout(now + 1, terminate) else: instance.stop() # After process all _callbacks and _timeouts, break IOLoop.instance() logging.info('Shutdown...') # process recursion terminate()