-
-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Description
Each pg-boss worker currently polls the database every pollingIntervalSeconds seconds (defaulting to 2) checking for new work. This is pretty heavy-weight on the CPU (not to mention having to open a DB connection, etc.).
As an alternative for efficiency (and testability), consider having each worker do a single pass at startup to calculate the next deadline at which work is due, then sleep until either:
- The deadline is reached, or
- A new job is scheduled, or
- An existing job is modified / cancelled
For 2) and 3), we can recalculate the next deadline and update the affected worker(s).
I don't know if this might be impacted by database replication, of course, so we'd have to take that into account.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels