From 60c74785ded83c1326fc2ce807311679ef03dfcf Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 21 Jun 2025 06:56:30 -0400 Subject: [PATCH 1/2] Ignore `TUBESYNC_WORKERS` entirely --- tubesync/tubesync/settings.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tubesync/tubesync/settings.py b/tubesync/tubesync/settings.py index df3ca953..18e27044 100644 --- a/tubesync/tubesync/settings.py +++ b/tubesync/tubesync/settings.py @@ -166,9 +166,6 @@ HEALTHCHECK_ALLOWED_IPS = ('127.0.0.1',) MAX_ATTEMPTS = 15 # Number of times tasks will be retried MAX_RUN_TIME = 12*(60*60) # Maximum amount of time in seconds a task can run -BACKGROUND_TASK_RUN_ASYNC = False # Run tasks async in the background -BACKGROUND_TASK_ASYNC_THREADS = 1 # Number of async tasks to run at once -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) @@ -244,8 +241,9 @@ if MAX_RUN_TIME < 600: DOWNLOAD_MEDIA_DELAY = 1 + round(MAX_RUN_TIME / 100) -if BACKGROUND_TASK_ASYNC_THREADS > MAX_BACKGROUND_TASK_ASYNC_THREADS: - BACKGROUND_TASK_ASYNC_THREADS = MAX_BACKGROUND_TASK_ASYNC_THREADS +BACKGROUND_TASK_RUN_ASYNC = False +BACKGROUND_TASK_ASYNC_THREADS = 1 +# MAX_BACKGROUND_TASK_ASYNC_THREADS = 1 from .dbutils import patch_ensure_connection # noqa From 0102f4f92f95ef7e23e0ac4e41c6b53342ad3fd2 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 21 Jun 2025 07:02:48 -0400 Subject: [PATCH 2/2] Stop using `BACKGROUND_TASK_ASYNC_THREADS` setting --- tubesync/sync/youtube.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tubesync/sync/youtube.py b/tubesync/sync/youtube.py index f8516b69..9de460a1 100644 --- a/tubesync/sync/youtube.py +++ b/tubesync/sync/youtube.py @@ -209,10 +209,6 @@ def get_media_info(url, /, *, days=None, info_json=None): 'verbose': True if settings.DEBUG else False, 'writeinfojson': True, }) - if settings.BACKGROUND_TASK_RUN_ASYNC: - opts.update({ - 'sleep_interval_requests': 2 * settings.BACKGROUND_TASK_ASYNC_THREADS, - }) if start: log.debug(f'get_media_info: used date range: {opts["daterange"]} for URL: {url}') response = {} @@ -353,8 +349,8 @@ def download_media( 'overwrites': None, 'skip_unavailable_fragments': False, 'sleep_interval': 10, - 'max_sleep_interval': min(20*60, max(60, settings.DOWNLOAD_MEDIA_DELAY)), - 'sleep_interval_requests': 1 + (2 * settings.BACKGROUND_TASK_ASYNC_THREADS), + 'max_sleep_interval': min(15*60, max(60, settings.DOWNLOAD_MEDIA_DELAY)), + 'sleep_interval_requests': 3, 'extractor_args': opts.get('extractor_args', dict()), 'paths': opts.get('paths', dict()), 'postprocessor_args': opts.get('postprocessor_args', dict()),