diff --git a/server/apps/edu/views.py b/server/apps/edu/views.py index 94d859c..bbcabab 100644 --- a/server/apps/edu/views.py +++ b/server/apps/edu/views.py @@ -150,8 +150,14 @@ class CertificateViewSet(CreateUpdateCustomMixin, ModelViewSet): # Fetch the objects to update Certificate.objects.filter(id__in=ids).update(**updates) queryset = Certificate.objects.filter(id__in=ids) - thread = threading.Thread(target=make_img_x, args=(queryset,)) - thread.start() + threads = [] + for obj in queryset: + thread = threading.Thread(target=make_img_x, args=(obj,)) + threads.append(thread) + thread.start() + + for thread in threads: + thread.join() # # Update the objects # for obj in objects: # # for field, value in updates.items():