From c32a53c40b9a8d3f543c4b1351e09185f9c53e0b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Dec 2025 14:51:31 +0000 Subject: [PATCH] Optimize memory usage by fetching only required fields Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- back/loaders/initData.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index b3407eb6..9e90daf0 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -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[] = []; for (const cron of allCrons) {