From 3c1634b797b05b8551f598ee1837bcfed9328db9 Mon Sep 17 00:00:00 2001 From: zty Date: Mon, 5 Aug 2024 09:36:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20edu=20=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/apps/edu/views.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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():