Address code review feedback - improve null checks

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-22 14:48:11 +00:00
parent 1124040eeb
commit a56f2393a4
2 changed files with 5 additions and 3 deletions

View File

@ -398,8 +398,8 @@ export function psTree(pid: number): Promise<number[]> {
} }
export function isPidRunning(pid: number): boolean { export function isPidRunning(pid: number): boolean {
// Validate PID is a positive integer // Validate PID: must be a positive integer
if (!pid || pid <= 0 || !Number.isInteger(pid)) { if (pid == null || pid <= 0 || !Number.isInteger(pid)) {
return false; return false;
} }

View File

@ -143,7 +143,9 @@ export default async () => {
continue; continue;
} }
// 收集需要重置的任务 ID // 收集需要重置的任务 ID
idsToReset.push(cron.id!); if (cron.id) {
idsToReset.push(cron.id);
}
} }
// 批量更新所有需要重置的任务 // 批量更新所有需要重置的任务