mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 09:11:12 +00:00
fix(cron): migrate legacy schedule cron fields on load (#28889)
Backfill legacy jobs that still use schedule.cron and jobId so upgraded instances keep firing existing cron schedules instead of failing silently. Closes #28861
This commit is contained in:
@@ -25,6 +25,19 @@ describe("cron schedule", () => {
|
||||
).toThrow("invalid cron schedule: expr is required");
|
||||
});
|
||||
|
||||
it("supports legacy cron field when expr is missing", () => {
|
||||
const nowMs = Date.parse("2025-12-13T00:00:00.000Z");
|
||||
const next = computeNextRunAtMs(
|
||||
{
|
||||
kind: "cron",
|
||||
cron: "0 9 * * 3",
|
||||
tz: "America/Los_Angeles",
|
||||
} as unknown as { kind: "cron"; expr: string; tz?: string },
|
||||
nowMs,
|
||||
);
|
||||
expect(next).toBe(Date.parse("2025-12-17T17:00:00.000Z"));
|
||||
});
|
||||
|
||||
it("computes next run for every schedule", () => {
|
||||
const anchor = Date.parse("2025-12-13T00:00:00.000Z");
|
||||
const now = anchor + 10_000;
|
||||
|
||||
Reference in New Issue
Block a user