perf: 修复发布机任务执行失败的问题

pull/11305/head
Eric 1 year ago
parent 8f10b84e94
commit 45e1723aa9

@ -1,3 +1,4 @@
from django.db import transaction
from rest_framework import status
from rest_framework import viewsets
from rest_framework.decorators import action
@ -58,7 +59,8 @@ class AppletHostDeploymentViewSet(viewsets.ModelViewSet):
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
instance = serializer.save()
with transaction.atomic():
instance = serializer.save()
task = run_applet_host_deployment.delay(instance.id)
instance.save_task(task.id)
return Response({'task': str(task.id)}, status=201)

Loading…
Cancel
Save