Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

perf: 任务列表响应速度优化 #7489 #7498

Merged
merged 6 commits into from
Jun 25, 2024

Conversation

lTimej
Copy link
Collaborator

@lTimej lTimej commented Jun 18, 2024

No description provided.

@lTimej lTimej added the type/optimization 优化 label Jun 18, 2024
@lTimej lTimej requested a review from normal-wls June 18, 2024 12:07
@lTimej lTimej linked an issue Jun 18, 2024 that may be closed by this pull request
@@ -307,6 +311,13 @@ def list(self, request, *args, **kwargs):
)

page = list(queryset)
elif "no_pagination" in request.query_params:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no_pagination -> with_count

@@ -180,7 +180,10 @@ def paginate_list_data(request, queryset):
limit = int(request.GET.get("limit", 100))
# limit 最大数量为200
limit = 200 if limit > 200 else limit
count = queryset.count()
if request.GET.get("no_pagination"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without_count

@@ -180,7 +180,10 @@ def paginate_list_data(request, queryset):
limit = int(request.GET.get("limit", 100))
# limit 最大数量为200
limit = 200 if limit > 200 else limit
count = queryset.count()
if request.GET.get("no_pagination"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_task_list apigw api 文档说明

@@ -15,6 +15,7 @@
| expected_timezone | string | 否 | 任务时间相关字段期望返回的时区,形如Asia/Shanghai |
| limit | int | 否 | 分页,返回任务列表任务数,默认为100 |
| offset | int | 否 | 分页,返回任务列表起始任务下标,默认为0 |
| without_count | bool | 否 | 有无count,默认有 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without_count=false 会有问题,【默认有】改成【默认返回 count 信息】

@@ -180,7 +180,10 @@ def paginate_list_data(request, queryset):
limit = int(request.GET.get("limit", 100))
# limit 最大数量为200
limit = 200 if limit > 200 else limit
count = queryset.count()
if request.GET.get("without_count"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议添加一个参数,without_count=False

@normal-wls normal-wls merged commit 00f9099 into TencentBlueKing:master Jun 25, 2024
6 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

任务列表响应速度优化
2 participants