Skip to content

Commit

Permalink
Add cron options to constructor options type (#491)
Browse files Browse the repository at this point in the history
* Add cron options to constructor options type

* Document cron options
  • Loading branch information
louis-vs authored Sep 11, 2024
1 parent d2a97e3 commit 229937c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,8 @@ but **not** this format which is parsed as "only run exactly at 3:30:30 am every
30 30 3 * * *
```

To change how often schedules are checked, you can set `cronMonitorIntervalSeconds`. To change how often cron jobs are run, you can set `cronWorkerIntervalSeconds`.

In order mitigate clock skew and drift, every 10 minutes the clocks of each instance are compared to the database server's clock. The skew, if any, is stored and used as an offset during cron evaluation to ensure all instances are synchronized. Internally, job throttling options are then used to make sure only 1 job is sent even if multiple instances are running.

If needed, the default clock monitoring interval can be adjusted using `clockMonitorIntervalSeconds` or `clockMonitorIntervalMinutes`. Additionally, to disable scheduling on an instance completely, use the following in the constructor options.
Expand Down
3 changes: 3 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ declare namespace PgBoss {

clockMonitorIntervalSeconds?: number;
clockMonitorIntervalMinutes?: number;

cronMonitorIntervalSeconds?: number;
cronWorkerIntervalSeconds?: number;
}

interface MaintenanceOptions {
Expand Down

0 comments on commit 229937c

Please sign in to comment.