From 6e3a647d6a4070ad92e83ca1c482d8eefe90d982 Mon Sep 17 00:00:00 2001 From: Styloy <100509373+Styloy@users.noreply.github.com> Date: Thu, 2 Jan 2025 23:21:17 -0500 Subject: [PATCH] add sleep_interval to queue.py (#832) add sleep_interval to mitigate rate_limiting induced errors when adding videos to queue --- backend/download/src/queue.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/download/src/queue.py b/backend/download/src/queue.py index 472da36f..e2777959 100644 --- a/backend/download/src/queue.py +++ b/backend/download/src/queue.py @@ -6,6 +6,7 @@ Functionality: import json from datetime import datetime +from time import sleep from appsettings.src.config import AppConfig from common.src.es_connect import ElasticWrap, IndexPaginate @@ -245,7 +246,9 @@ class PendingList(PendingIndex): total = len(self.missing_videos) videos_added = [] + sleep_interval = self.config["downloads"].get("sleep_interval", 0) for idx, (youtube_id, vid_type) in enumerate(self.missing_videos): + sleep(sleep_interval) if self.task and self.task.is_stopped(): break