mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-05 20:51:15 -07:00
Check cloud status on startup before connecting websocket
This commit is contained in:
parent
a5d2467bfe
commit
a53afe05a2
3 changed files with 13 additions and 3 deletions
|
@ -196,7 +196,7 @@ def main():
|
|||
|
||||
# Open connection for websocket
|
||||
try:
|
||||
web_socket.start_thread()
|
||||
web_socket.start_thread(startup=True)
|
||||
except:
|
||||
logger.warn(u"Websocket :: Unable to open connection.")
|
||||
plexpy.initialize_scheduler()
|
||||
|
|
|
@ -328,7 +328,7 @@ def check_server_updates():
|
|||
logger.info(u"Tautulli Monitor :: No PMS update available.")
|
||||
|
||||
|
||||
def check_cloud_status(log=False):
|
||||
def check_cloud_status(log=False, return_status=False):
|
||||
if log:
|
||||
logger.info(u"Tautulli Monitor :: Checking for Plex Cloud server status...")
|
||||
|
||||
|
@ -337,7 +337,11 @@ def check_cloud_status(log=False):
|
|||
|
||||
if cloud_status:
|
||||
logger.info(u"Tautulli Monitor :: Plex Cloud server is active.")
|
||||
if return_status:
|
||||
return cloud_status
|
||||
check_server_response()
|
||||
else:
|
||||
if log:
|
||||
logger.info(u"Tautulli Monitor :: Plex Cloud server is sleeping.")
|
||||
if return_status:
|
||||
return cloud_status
|
||||
|
|
|
@ -32,7 +32,13 @@ opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
|
|||
ws_reconnect = False
|
||||
|
||||
|
||||
def start_thread():
|
||||
def start_thread(startup=False):
|
||||
if startup and plexpy.CONFIG.PMS_IS_CLOUD and plexpy.PLEX_SERVER_UP is None:
|
||||
plexpy.PLEX_SERVER_UP = activity_pinger.check_cloud_status(log=True, return_status=True)
|
||||
if not plexpy.PLEX_SERVER_UP:
|
||||
on_disconnect()
|
||||
return
|
||||
|
||||
if plexpy.CONFIG.FIRST_RUN_COMPLETE:
|
||||
# Check for any existing sessions on start up
|
||||
activity_pinger.check_active_sessions(ws_request=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue