Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def shutdown():
log.info('Stopping http server')
broadcast_offline()
# 关闭本进程所有的客户端连接并将用户从在线列表中去掉。
log.info('make all user offline')
try:
WebSocketHandler.shutdown()
except Exception, e:
log.error(e, exc_info=True)
log.info('Will shutdown in %s seconds ...',
MAX_WAIT_SECONDS_BEFORE_SHUTDOWN)
io_loop = tornado.ioloop.IOLoop.instance()
deadline = time.time() + MAX_WAIT_SECONDS_BEFORE_SHUTDOWN
def stop_loop():
now = time.time()
if now < deadline and (io_loop._callbacks or io_loop._timeouts):