From ad45d4708b6af8d1e4d35a7bce235e76e074f689 Mon Sep 17 00:00:00 2001 From: juan Date: Sun, 10 May 2026 11:49:50 -0700 Subject: [PATCH] fix: Handle failed status requests in SABnzbd check_connected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the qBit fix from #342. Previously, an HTTP error from SABnzbd's status endpoint (e.g. a 500 from a misbehaving SAB instance) would raise out of make_request and crash decluttarr entirely. Now the error is caught and treated as a disconnected client, so the cycle is skipped and retried next run — matching the behavior for qBit in #342. Co-Authored-By: Claude Opus 4.7 --- src/settings/_download_clients_sabnzbd.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/settings/_download_clients_sabnzbd.py b/src/settings/_download_clients_sabnzbd.py index 683d2f5..937c709 100644 --- a/src/settings/_download_clients_sabnzbd.py +++ b/src/settings/_download_clients_sabnzbd.py @@ -155,14 +155,21 @@ async def check_connected(self): "_download_clients_sabnzbd.py/check_connected: Checking if SABnzbd is connected" ) params = {"mode": "status", "apikey": self.api_key, "output": "json"} - response = await make_request( - "get", - self.api_url, - self.settings, - timeout=self.timeout, - params=params, - ) - status_data = response.json() + try: + response = await make_request( + "get", + self.api_url, + self.settings, + timeout=self.timeout, + params=params, + ) + status_data = response.json() + except Exception: + logger.warning( + ">>> %s: Failed to reach SABnzbd status endpoint. Treating as disconnected.", + self.name, + ) + return False # SABnzbd doesn't have a direct "disconnected" status like qBittorrent # We check if we can get status successfully return "status" in status_data