Close websocket cleanly on shutdown

This commit is contained in:
JonnyWong16 2018-03-12 19:38:19 -07:00
commit 7362dd0bf4
2 changed files with 33 additions and 20 deletions

View file

@ -46,6 +46,7 @@ import notifiers
import plextv
import users
import versioncheck
import web_socket
import plexpy.config
PROG_DIR = None
@ -95,6 +96,7 @@ HTTP_ROOT = None
DEV = False
WEBSOCKET = None
WS_CONNECTED = False
PLEX_SERVER_UP = None
@ -1622,6 +1624,10 @@ def upgrade():
def shutdown(restart=False, update=False, checkout=False):
cherrypy.engine.exit()
# Shutdown the websocket connection
if WEBSOCKET:
web_socket.shutdown()
if SCHED.running:
SCHED.shutdown(wait=False)
if activity_handler.ACTIVITY_SCHED.running: