feat: Add 5-second timeout to all network requests

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-04 12:10:32 -07:00
parent 196767001c
commit c5fbad8ad6

View File

@@ -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}")