From 2f475bf2a894c9aeec48d1648768f5391755cc3f Mon Sep 17 00:00:00 2001 From: Laurent DEFERT Date: Wed, 28 Dec 2022 12:37:32 +0100 Subject: [PATCH] limit the number of videos to process --- tubesync/sync/models.py | 6 +++++- tubesync/tubesync/settings.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index b2aeea5..71dbed6 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -477,7 +477,11 @@ class Source(models.Model): response = indexer(self.index_url) if not isinstance(response, dict): return [] - return response.get('entries', []) + entries = response.get('entries', []) + + if settings.MAX_ENTRIES_PROCESSING: + entries = entries[:settings.MAX_ENTRIES_PROCESSING] + return entries def get_media_thumb_path(instance, filename): diff --git a/tubesync/tubesync/settings.py b/tubesync/tubesync/settings.py index 11ce66a..39e6b09 100644 --- a/tubesync/tubesync/settings.py +++ b/tubesync/tubesync/settings.py @@ -138,7 +138,7 @@ BACKGROUND_TASK_ASYNC_THREADS = 1 # Number of async tasks to run at on MAX_BACKGROUND_TASK_ASYNC_THREADS = 8 # For sanity reasons BACKGROUND_TASK_PRIORITY_ORDERING = 'ASC' # Use 'niceness' task priority ordering COMPLETED_TASKS_DAYS_TO_KEEP = 7 # Number of days to keep completed tasks - +MAX_ENTRIES_PROCESSING = 0 # Number of videos to process on source refresh (0 for no limit) SOURCES_PER_PAGE = 100 MEDIA_PER_PAGE = 144