Merge pull request #11578 from jumpserver/pr@dev@perf_host_deploy_log

perf: 修复发布机历史执行任务日志无法查看的问题
pull/11580/head
Eric_Lee 1 year ago committed by GitHub
commit bb1e674367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,12 +59,12 @@ class AppletHostDeploymentViewSet(viewsets.ModelViewSet):
@staticmethod
def start_deploy(instance):
task = run_applet_host_deployment.apply_async((instance.id,), task_id=str(instance.id))
instance.save_task(task.id)
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
instance = serializer.save()
instance.save_task(instance.id)
transaction.on_commit(lambda: self.start_deploy(instance))
return Response({'task': str(instance.id)}, status=201)

Loading…
Cancel
Save