feat: Asynchronous resolution processing

Refactor the image and video resolution creation process to be
asynchronous. This change optimizes performance by sending
`original_image.id` and `original_video.id` to
`create_image_resolutions.delay` and `create_video_resolutions.delay`
respectively, rather than processing synchronously. This enhancement
significantly improves the scalability of handling large sets of images
and videos, ensuring system resources are utilized more efficiently and
users experience less delay.
This commit is contained in:
Kumi 2024-03-17 13:48:00 +01:00
parent f01390eb5c
commit 6ba838f770
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -8,7 +8,7 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
for original_image in OriginalImage.objects.all(): for original_image in OriginalImage.objects.all():
create_image_resolutions(original_image) create_image_resolutions.delay(original_image.id)
for original_video in OriginalVideo.objects.all(): for original_video in OriginalVideo.objects.all():
create_video_resolutions(original_video) create_video_resolutions.delay(original_video.id)