()
| 451 | } |
| 452 | |
| 453 | async function bootstrapTasks() { |
| 454 | try { |
| 455 | const db = await getDB(); |
| 456 | for (const t of db.data.tasks) { |
| 457 | // 跳过无效表达式 |
| 458 | if (!cron.validateCronExpression(t.cron).valid) continue; |
| 459 | if (t.disabled) continue; |
| 460 | await scheduleTask(t); |
| 461 | } |
| 462 | } catch (e) { |
| 463 | console.error("[acron] bootstrap 失败:", e); |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | // 启动时注册历史任务(异步,不阻塞加载) |
| 468 | bootstrapTasks(); |
no test coverage detected