Skip to content

Commit

Permalink
[patch] Added logic to check download queue before re-searching or po…
Browse files Browse the repository at this point in the history
…sting any search at all
  • Loading branch information
Feramance committed Aug 25, 2023
1 parent 3dfc3f6 commit caa22a1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,8 @@ def _process_failed_individual(self, hash_: str, entry: int, skip_blacklist: set
"Re-Searching episode: %s",
object_id,
)
self.post_command("EpisodeSearch", episodeIds=[object_id])
if object_id not in self.queue_file_ids:
self.post_command("EpisodeSearch", episodeIds=[object_id])
if self.persistent_queue and series_id:
self.persistent_queue.insert(EntryId=series_id).on_conflict_ignore()
elif self.type == "radarr":
Expand All @@ -848,7 +849,8 @@ def _process_failed_individual(self, hash_: str, entry: int, skip_blacklist: set
"Re-Searching movie: %s",
object_id,
)
self.post_command("MoviesSearch", movieIds=[object_id])
if object_id not in self.queue_file_ids:
self.post_command("MoviesSearch", movieIds=[object_id])
if self.persistent_queue:
self.persistent_queue.insert(EntryId=object_id).on_conflict_ignore()

Expand Down Expand Up @@ -1383,8 +1385,8 @@ def db_update(self):
.order_by(self.model_arr_file.Added.desc())
):
self.db_update_single_series(db_entry=movies)
except BaseException as e:
self.logger.error(e.message)
except BaseException:
self.logger.error("Connection Error")
raise DelayLoopException(length=300, type="delay")
self.logger.trace(f"Finished updating database")

Expand Down Expand Up @@ -1921,7 +1923,8 @@ def maybe_do_search(
Completed=False,
EntryId=file_model.EntryId,
).on_conflict_replace().execute()
self.client.post_command(self.search_api_command, seriesId=file_model.EntryId)
if file_model.EntryId not in self.queue_file_ids:
self.client.post_command(self.search_api_command, seriesId=file_model.EntryId)
file_model.Searched = True
file_model.save()
self.logger.hnotice(
Expand Down Expand Up @@ -3229,6 +3232,7 @@ def run_search_loop(self) -> NoReturn:
while True:
timer = datetime.now(timezone.utc)
try:
self.refresh_download_queue()
self.db_maybe_reset_entry_searched_state()
self.db_update()
self.run_request_search()
Expand Down

0 comments on commit caa22a1

Please sign in to comment.