Merge pull request #856 from tcely/patch-12

Reschedule download tasks when metadata is not ready
This commit is contained in:
meeb 2025-03-18 02:54:34 +11:00 committed by GitHub
commit 58c4964939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -422,6 +422,8 @@ def download_media_thumbnail(media_id, url):
except Media.DoesNotExist:
# Task triggered but the media no longer exists, do nothing
return
if not media.has_metadata:
raise DownloadFailedException('Metadata is not yet available.')
if media.skip:
# Media was toggled to be skipped after the task was scheduled
log.warn(f'Download task triggered for media: {media} (UUID: {media.pk}) but '
@ -459,6 +461,8 @@ def download_media(media_id):
except Media.DoesNotExist:
# Task triggered but the media no longer exists, do nothing
return
if not media.has_metadata:
raise DownloadFailedException('Metadata is not yet available.')
if media.skip:
# Media was toggled to be skipped after the task was scheduled
log.warn(f'Download task triggered for media: {media} (UUID: {media.pk}) but '