dynamic sleep

This commit is contained in:
Simon
2025-01-03 11:41:55 +07:00
parent 490b61961a
commit 2dbce9da4d
5 changed files with 23 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ from time import sleep
from appsettings.src.config import AppConfig
from common.src.es_connect import ElasticWrap, IndexPaginate
from common.src.helper import get_duration_str, is_shorts
from common.src.helper import get_duration_str, get_sleep, is_shorts
from download.src.subscriptions import ChannelSubscription
from download.src.thumbnails import ThumbManager
from download.src.yt_dlp_base import YtWrap
@@ -246,9 +246,7 @@ 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
@@ -277,6 +275,8 @@ class PendingList(PendingIndex):
self._ingest_bulk(bulk_list)
bulk_list = []
sleep(get_sleep(self.config))
self._ingest_bulk(bulk_list)
return videos_added