From db651e16b9ba74b60bbd36469da45b02dad9c5e5 Mon Sep 17 00:00:00 2001 From: meeb Date: Mon, 22 Feb 2021 13:24:11 +1100 Subject: [PATCH] raise a manual exception when youtube-dl extract_info returns no data to trigger backoffs, increase backoff retry and timers, resolves #66 --- tubesync/sync/youtube.py | 5 +++++ tubesync/tubesync/settings.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/youtube.py b/tubesync/sync/youtube.py index 1c91bf4..0c1afdc 100644 --- a/tubesync/sync/youtube.py +++ b/tubesync/sync/youtube.py @@ -46,6 +46,11 @@ def get_media_info(url): response = y.extract_info(url, download=False) except youtube_dl.utils.DownloadError as e: raise YouTubeError(f'Failed to extract_info for "{url}": {e}') from e + if not response: + raise YouTubeError(f'Failed to extract_info for "{url}": No metadata was ' + f'returned by youtube-dl, check for error messages in the ' + f'logs above. This task will be retried later with an ' + f'exponential backoff.') return response diff --git a/tubesync/tubesync/settings.py b/tubesync/tubesync/settings.py index 90e9c2c..aceb983 100644 --- a/tubesync/tubesync/settings.py +++ b/tubesync/tubesync/settings.py @@ -128,7 +128,7 @@ HEALTHCHECK_FIREWALL = True HEALTHCHECK_ALLOWED_IPS = ('127.0.0.1',) -MAX_ATTEMPTS = 10 # Number of times tasks will be retried +MAX_ATTEMPTS = 15 # Number of times tasks will be retried MAX_RUN_TIME = 1800 # Maximum amount of time in seconds a task can run BACKGROUND_TASK_RUN_ASYNC = True # Run tasks async in the background BACKGROUND_TASK_ASYNC_THREADS = 1 # Number of async tasks to run at once