mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 00:06:07 -07:00
Flush temporary sessions automatically if failed to check sessions on startup
This commit is contained in:
parent
e3b71a729e
commit
a5807f21b4
2 changed files with 11 additions and 4 deletions
|
@ -293,8 +293,8 @@ def connect_server(log=True, startup=False):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
web_socket.start_thread()
|
web_socket.start_thread()
|
||||||
except:
|
except Exception as e:
|
||||||
logger.error(u"Websocket :: Unable to open connection.")
|
logger.error(u"Websocket :: Unable to open connection: %s." % e)
|
||||||
|
|
||||||
|
|
||||||
def check_server_access():
|
def check_server_access():
|
||||||
|
|
|
@ -25,6 +25,7 @@ import plexpy
|
||||||
import activity_handler
|
import activity_handler
|
||||||
import activity_pinger
|
import activity_pinger
|
||||||
import activity_processor
|
import activity_processor
|
||||||
|
import database
|
||||||
import logger
|
import logger
|
||||||
|
|
||||||
name = 'websocket'
|
name = 'websocket'
|
||||||
|
@ -33,8 +34,14 @@ ws_shutdown = False
|
||||||
|
|
||||||
|
|
||||||
def start_thread():
|
def start_thread():
|
||||||
|
try:
|
||||||
# Check for any existing sessions on start up
|
# Check for any existing sessions on start up
|
||||||
activity_pinger.check_active_sessions(ws_request=True)
|
activity_pinger.check_active_sessions(ws_request=True)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(u"Tautulli WebSocket :: Failed to check for active sessions: %s." % e)
|
||||||
|
logger.warn(u"Tautulli WebSocket :: Attempt to fix by flushing temporary sessions...")
|
||||||
|
database.delete_sessions()
|
||||||
|
|
||||||
# Start the websocket listener on it's own thread
|
# Start the websocket listener on it's own thread
|
||||||
thread = threading.Thread(target=run)
|
thread = threading.Thread(target=run)
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue