@@ -35,7 +35,7 @@ async def removal_jobs(self):
3535 if not await self ._queue_has_items ():
3636 return
3737
38- if not await self ._qbit_connected ():
38+ if not await self ._download_clients_connected ():
3939 return
4040
4141 # Refresh trackers
@@ -57,11 +57,17 @@ async def search_jobs(self):
5757 return
5858 if self .settings .jobs .search_missing .enabled :
5959 await SearchHandler (
60- arr = self .arr , settings = self .settings , missing_or_cutoff = "missing" , job_name = "search_missing"
60+ arr = self .arr ,
61+ settings = self .settings ,
62+ missing_or_cutoff = "missing" ,
63+ job_name = "search_missing" ,
6164 ).handle_search ()
6265 if self .settings .jobs .search_unmet_cutoff .enabled :
6366 await SearchHandler (
64- arr = self .arr , settings = self .settings , missing_or_cutoff = "cutoff" , job_name = "search_cutoff_unmet"
67+ arr = self .arr ,
68+ settings = self .settings ,
69+ missing_or_cutoff = "cutoff" ,
70+ job_name = "search_cutoff_unmet" ,
6571 ).handle_search ()
6672
6773 async def _queue_has_items (self ):
@@ -81,27 +87,22 @@ async def _queue_has_items(self):
8187 logger .verbose ("Removal Jobs: None triggered (Queue is empty)" )
8288 return False
8389
84- async def _qbit_connected (self ):
85- for qbit in self .settings .download_clients .qbittorrent :
86- logger .debug (
87- f"job_manager.py/_queue_has_items (Before any removal jobs): Checking if qbit is connected to the internet"
88- )
89- # Check if any client is disconnected
90- if not await qbit .check_qbit_connected ():
91- logger .warning (
92- f">>> qBittorrent is disconnected. Skipping queue cleaning on { self .arr .name } ." ,
93- )
90+ async def _download_clients_connected (self ):
91+ for clients in [
92+ self .settings .download_clients .qbittorrent ,
93+ self .settings .download_clients .sabnzbd ,
94+ ]:
95+ if not await self ._check_client_connection_status (clients ):
9496 return False
97+ return True
9598
96- for sabnzbd in self .settings .download_clients .sabnzbd :
99+ async def _check_client_connection_status (self , clients ):
100+ for client in clients :
97101 logger .debug (
98- f"job_manager.py/_queue_has_items (Before any removal jobs) : Checking if SABnzbd is connected"
102+ f"job_manager.py/_check_client_connection_status : Checking if { client . name } is connected"
99103 )
100- # Check if any client is disconnected
101- if not await sabnzbd .check_sabnzbd_connected ():
102- logger .warning (
103- f">>> SABnzbd is disconnected. Skipping queue cleaning on { self .arr .name } ." ,
104- )
104+ if not await client .check_connected ():
105+ logger .warning (f">>> { client .name } is disconnected. Skipping queue cleaning on { self .arr .name } ." )
105106 return False
106107 return True
107108
0 commit comments