Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

perf: 周期任务运营优化 #7364 #7399

Conversation

lTimej
Copy link
Collaborator

@lTimej lTimej commented Mar 26, 2024

No description provided.

@lTimej lTimej added the type/optimization 优化 label Mar 26, 2024
@lTimej lTimej linked an issue Mar 26, 2024 that may be closed by this pull request
config/default.py Outdated Show resolved Hide resolved
PERIOD_TASK_TIMES = env.PERIOD_TASK_TIMES

# 周期任务自动关闭扫描周期
EXPIRED_SESSION_PERIOD_TASK_SCAN = env.EXPIRED_SESSION_PERIOD_TASK_SCAN
Copy link
Member

Choose a reason for hiding this comment

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

PERIODIC_TASK_REMINDER_SCAN_CRON

config/default.py Outdated Show resolved Hide resolved
</section>
<div class="renewal-action-flex">
<div class="renewal-action" id="renewal-button"><a style="color: #fff;" href="{{ url }}">马上续期</a></div>
<!-- <div>如不再需要,请在<a style="color: #3a84ff;" href="{{ index_url }}">「我的权限」</a>页面回收</div> -->
Copy link
Member

Choose a reason for hiding this comment

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

没用的代码直接去掉

gcloud/core/templates/core/period_task_notice_mail.html Outdated Show resolved Hide resolved
queryset = PeriodicTask.objects.filter(task__celery_task__enabled=True).order_by("-edit_time")
task_creators = queryset.values("task__creator").distinct()
data = {}
for task_creator in task_creators:
Copy link
Member

Choose a reason for hiding this comment

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

这里面的查询建议优化下,在 for 里面做的查询太多了,建议做统一的数据获取,然后在循环中计算

gcloud/core/tasks.py Outdated Show resolved Hide resolved
gcloud/core/tasks.py Outdated Show resolved Hide resolved
gcloud/core/tasks.py Outdated Show resolved Hide resolved
gcloud/core/tasks.py Outdated Show resolved Hide resolved
@lTimej lTimej force-pushed the master_7364 branch 3 times, most recently from d443737 to a55c9c2 Compare April 9, 2024 04:51
env.py Outdated Show resolved Hide resolved
gcloud/core/tasks.py Outdated Show resolved Hide resolved
gcloud/core/tasks.py Show resolved Hide resolved
gcloud/core/tasks.py Outdated Show resolved Hide resolved
@normal-wls
Copy link
Member

需要补充一个管理员接口

@normal-wls normal-wls linked an issue Apr 15, 2024 that may be closed by this pull request
1 task
@normal-wls normal-wls merged commit a2cc98f into TencentBlueKing:feature_periodic_task_optimization_master Apr 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

周期任务,所有开启的周期任务一起排到前列 周期任务运营优化
2 participants