From ffbfea5f2cdc3dad5035f856e8051f2fb62f0d3d Mon Sep 17 00:00:00 2001 From: Benjamin Harder Date: Sun, 12 May 2024 15:38:40 +0200 Subject: [PATCH] Checking if qBit is connected prior to slowness check --- src/jobs/remove_slow.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/jobs/remove_slow.py b/src/jobs/remove_slow.py index 9f26a03..f66b103 100644 --- a/src/jobs/remove_slow.py +++ b/src/jobs/remove_slow.py @@ -13,6 +13,13 @@ async def remove_slow(settingsDict, BASE_URL, API_KEY, NAME, deleted_downloads, # Find items affected affectedItems = [] alreadyCheckedDownloadIDs = [] + + if settingsDict['QBITTORRENT_URL']: + qBitConnectionStatus = await rest_get(settingsDict['QBITTORRENT_URL']+'/sync/maindata', cookies=settingsDict['QBIT_COOKIE'])['server_state']['connection_status'] + if qBitConnectionStatus == 'disconnected': + logger.warning('>>> qBittorrent is disconnected. Skipping %s queue cleaning failed on %s.',failType) + return 0 + for queueItem in queue['records']: if 'downloadId' in queueItem and 'size' in queueItem and 'sizeleft' in queueItem and 'status' in queueItem: if queueItem['downloadId'] not in alreadyCheckedDownloadIDs: