fix(workflow-engine-*): scheduled jobs interval (#11800)

**What**
Currently only cron pattern are supported by scheduled jobs, this can lead to issue. for example you set the pattern to execute every hours at minute 0 and second 0 (as it is expected to execute at exactly this constraint) but due to the moment it gets executed we our out of the second 0 then the job wont get executed until the next scheduled cron table execution.

With this pr we introduce the `interval` configuration which allows you the specify a delay between execution in ms (e.g every minute -> 60 * 1000 ms) which ensure that once a job is executed another one is scheduled for a minute later.

**Usage**
```ts
// jobs/job-1.ts
const thirtySeconds = 30 * 1000

export const config = {
  name: "job-1",
  schedule: {
    interval: thirtySeconds
  },
}
```
This commit is contained in:
Adrien de Peretti
2025-03-13 16:05:13 +01:00
committed by GitHub
parent e05491c24f
commit fc652ea51e
6 changed files with 98 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ import { ResourceLoader } from "../utils/resource-loader"
type CronJobConfig = {
name: string
schedule: string
schedule: string | SchedulerOptions
numberOfExecutions?: SchedulerOptions["numberOfExecutions"]
}