Force shutdowns the socket server on closing chat server

This commit is contained in:
Saptak S 2021-04-19 02:59:22 +05:30
parent 530f9547f5
commit a4ae37d203
No known key found for this signature in database
GPG Key ID: 2D9B32E54C68A3FB

View File

@ -360,13 +360,18 @@ class Web:
# Shutdown the flask service
try:
func = request.environ.get("werkzeug.server.shutdown")
if func is None:
if func is None and self.mode != "chat":
raise RuntimeError("Not running with the Werkzeug Server")
func()
except:
pass
self.running = False
# If chat, shutdown the socket server
if self.mode == "chat":
self.socketio.stop()
def start(self, port):
"""
Start the flask web server.