From 3cd98457c26916bcbc703169d70a19683dd95256 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 26 Mar 2022 15:47:53 -0700 Subject: [PATCH] Apply PMS_TIMEOUT setting to websocket connection --- plexpy/web_socket.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plexpy/web_socket.py b/plexpy/web_socket.py index de4bb3cd..b70d4b6e 100644 --- a/plexpy/web_socket.py +++ b/plexpy/web_socket.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # This file is part of Tautulli. # @@ -182,6 +182,8 @@ def run(): else: header = None + timeout = plexpy.CONFIG.PMS_TIMEOUT + global ws_shutdown ws_shutdown = False reconnects = 0 @@ -189,7 +191,7 @@ def run(): # Try an open the websocket connection logger.info("Tautulli WebSocket :: Opening %swebsocket." % secure) try: - plexpy.WEBSOCKET = create_connection(uri, header=header, sslopt=sslopt) + plexpy.WEBSOCKET = create_connection(uri, timeout=timeout, header=header, sslopt=sslopt) logger.info("Tautulli WebSocket :: Ready") plexpy.WS_CONNECTED = True except (websocket.WebSocketException, IOError, Exception) as e: @@ -222,7 +224,7 @@ def run(): logger.warn("Tautulli WebSocket :: Reconnection attempt %s." % str(reconnects)) try: - plexpy.WEBSOCKET = create_connection(uri, header=header, sslopt=sslopt) + plexpy.WEBSOCKET = create_connection(uri, timeout=timeout, header=header, sslopt=sslopt) logger.info("Tautulli WebSocket :: Ready") plexpy.WS_CONNECTED = True except (websocket.WebSocketException, IOError, Exception) as e: