diff --git a/api/src/scheduler/jobs-repo.ts b/api/src/scheduler/jobs-repo.ts index 5671d1202..8681c6376 100644 --- a/api/src/scheduler/jobs-repo.ts +++ b/api/src/scheduler/jobs-repo.ts @@ -146,10 +146,6 @@ export class JobsRepo { runAt = cron(runAt ?? new Date(), repeat.cron); } - if (repeat?.every) { - runAt = new Date(); - } - if (typeof repeat?.times === "number" && repeat.times < 1) { return; } diff --git a/api/test/jobs.test.ts b/api/test/jobs.test.ts index 11a43f455..7b5cb3728 100644 --- a/api/test/jobs.test.ts +++ b/api/test/jobs.test.ts @@ -363,6 +363,32 @@ function testAgainst(backend: "Redis" | "Mock") { expect(bodies).toEqual([]); }); + test("regression #27: delay & repeat.every", async () => { + await request(quirrel) + .post("/queues/" + endpoint) + .send({ + body: "delay & repeat.every", + delay: 100, + repeat: { + every: 100, + times: 2, + }, + }) + .expect(201); + + await delay(75); + + expect(bodies).toEqual([]); + + await delay(75); + + expect(bodies).toEqual(["delay & repeat.every"]); + + await delay(75); + + expect(bodies).toEqual(["delay & repeat.every", "delay & repeat.every"]); + }); + describe("cron jobs", () => { test("work", async () => { await request(quirrel)