Skip to content

Commit

Permalink
bugfix: 修复首页我的动态异常&任务列表缺少执行代理人的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshuaikang committed Aug 23, 2023
1 parent 043a143 commit 090325c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions gcloud/core/apis/drf/serilaziers/taskflow_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Meta:
"current_flow",
"engine_ver",
"flow_type",
"recorded_executor_proxy",
]


Expand Down
6 changes: 4 additions & 2 deletions gcloud/core/apis/drf/viewsets/taskflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,11 @@ def list(self, request, *args, **kwargs):
self.paginator.offset = self.paginator.get_offset(request)
self.paginator.count = -1
create_method = request.query_params.get("create_method")

queryset = self._optimized_my_dynamic_query(
queryset, request.user.username, self.paginator.limit, self.paginator.offset, create_method
)

page = list(queryset)
else:
page = self.paginate_queryset(queryset)
Expand Down Expand Up @@ -465,7 +467,7 @@ def _optimized_my_dynamic_query(queryset, username, limit, offset, create_method
"""
优化我的动态接口查询速度
"""
original_query = str(queryset.query)
original_query, params = queryset.query.sql_with_params()
new_query = re.sub(
"FROM (.*?) ON",
"FROM `pipeline_pipelineinstance` STRAIGHT_JOIN `taskflow3_taskflowinstance` ON",
Expand All @@ -476,7 +478,7 @@ def _optimized_my_dynamic_query(queryset, username, limit, offset, create_method
if create_method:
new_query = new_query.replace(create_method, f"'{create_method}'")
new_query += f" LIMIT {limit} OFFSET {offset}"
return TaskFlowInstance.objects.raw(new_query)
return TaskFlowInstance.objects.raw(original_query, params)

@swagger_auto_schema(
method="GET",
Expand Down

0 comments on commit 090325c

Please sign in to comment.