Optimize memory usage by fetching only required fields

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-22 14:51:31 +00:00
parent 8ae7a85bf8
commit c32a53c40b

View File

@ -133,7 +133,10 @@ export default async () => {
// 初始化更新所有任务状态为空闲 // 初始化更新所有任务状态为空闲
// 但保留仍在运行的任务的状态 // 但保留仍在运行的任务的状态
const allCrons = await CrontabModel.findAll({ raw: true }); const allCrons = await CrontabModel.findAll({
attributes: ['id', 'pid'],
raw: true,
});
const idsToReset: number[] = []; const idsToReset: number[] = [];
for (const cron of allCrons) { for (const cron of allCrons) {