From c5fbad8ad6b0e26c320089660c7bd37dd9ab77a7 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Wed, 4 Feb 2026 12:10:32 -0700 Subject: [PATCH] feat: Add 5-second timeout to all network requests Co-authored-by: aider (gemini/gemini-2.5-pro) --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 85b08cf..c6cf9b3 100644 --- a/main.py +++ b/main.py @@ -76,7 +76,7 @@ def call_mopidy_rpc(method, params=None): data['params'] = params try: - response = requests.post(settings.MOPIDY_RPC_URL, json=data) + response = requests.post(settings.MOPIDY_RPC_URL, json=data, timeout=5) response.raise_for_status() logging.info(f"Successfully called Mopidy RPC method: {method}") except requests.exceptions.RequestException as e: @@ -129,7 +129,7 @@ def main(): logging.info("Starting one-time force sync of all playlists...") api_url = f"{navidrome_url.rstrip('/')}/rest/getPlaylists.view" try: - response = requests.get(api_url, params=params) + response = requests.get(api_url, params=params, timeout=5) response.raise_for_status() except requests.exceptions.RequestException as e: logging.error(f"Error connecting to Navidrome: {e}") @@ -174,7 +174,7 @@ def main(): api_url = f"{navidrome_url.rstrip('/')}/rest/getPlaylists.view" try: - response = requests.get(api_url, params=params) + response = requests.get(api_url, params=params, timeout=5) response.raise_for_status() # Raise an exception for bad status codes except requests.exceptions.RequestException as e: logging.error(f"Error connecting to Navidrome: {e}")