mirror of
https://github.com/hansjone/dsh-ops-cron.git
synced 2026-10-11 06:40:45 +08:00
Allow cron_retrigger to immediately fire recurring jobs.
Recurring tasks can start one extra run now without changing the cron schedule; delay remains oneshot-only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
c11221606a
commit
3ce60b200c
5 changed files with 58 additions and 21 deletions
|
|
@ -35,7 +35,16 @@ test('isRetriggerable / publicJob.retriggerable for consumed oneshots', () => {
|
|||
assert.equal(isRetriggerable(base, []), true)
|
||||
assert.equal(publicJob(base, []).retriggerable, true)
|
||||
|
||||
assert.equal(isRetriggerable({ ...base, schedule: { kind: 'cron', expr: '0 9 * * *', timezone: 'UTC' } }, []), false)
|
||||
const cron = {
|
||||
...base,
|
||||
schedule: { kind: 'cron', expr: '0 9 * * *', timezone: 'UTC' },
|
||||
nextRunAt: now + 60_000,
|
||||
lastStatus: null,
|
||||
}
|
||||
assert.equal(isRetriggerable(cron, []), true)
|
||||
assert.equal(publicJob(cron, []).retriggerable, true)
|
||||
assert.equal(isRetriggerable(cron, [{ id: 'r1', jobId: 'j1', status: 'running' }]), false)
|
||||
|
||||
assert.equal(isRetriggerable({ ...base, nextRunAt: now + 60_000 }, []), false)
|
||||
assert.equal(isRetriggerable({ ...base, lastStatus: null }, []), false)
|
||||
assert.equal(isRetriggerable(base, [{ id: 'r1', jobId: 'j1', status: 'running' }]), false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue