Releases: timgit/pg-boss
10.0.0-beta1
Database changes
PostgreSQL 12 is now the minimum supported version. If you upgrade and run start()
, the database will automatically be upgraded. However, this release requires rebuilding almost all of the job table indexes, which may require a bit of downtime depending on the size of your queues. If this is a concern, you may extract the migration script via getMigrationPlans()
and run it against a backup to get an estimate on downtime.
If the standard auto-migration isn't desired, consider alternatives, such as running a new v10 schema side by side of a v9 schema until the v9 queues are drained.
API changes
-
MAJOR: Job retries are now opt-out instead of opt-in. The default
retryLimit
is now 2 retries. This will cause an issue for any job handlers that aren't idempotent. Consider settingretryLimit=0
on these queues if needed. -
MAJOR: Policy queues. Queues can now be optionally created using
createQueue()
with a new set of storage policies. Each policy will store jobs in dedicated partition tables (courtesy of Postgres's declarative partitioning). Additionally, these queues can store default retry and retention policies that will be auto-applied to all new jobs (see below).standard
(default): Standard queues are the default queue policy, which supports all existing features. This will provision a dedicated job partition for all jobs with this name.short
: Short queues only allow 1 item to be queued (in created state), which replaces the previoussendSingleton()
andsendOnce()
functions.singleton
: Singleton queues only allow 1 item to be active, which replaces the previousfetch()
optionenforceSingletonQueueActiveLimit
.stately
: Stately queues are a combination ofshort
andsingleton
, only allowing 1 job to be queued and 1 job active.
-
MAJOR: Dead letter queues replace completion jobs. Failed jobs will be added to optional dead letter queues after exhausting all retries. This is preferred over completion jobs to gain retry support via
work()
. Additionally, dead letter queues only make a copy of the job if it fails, instead of filling up the job table with numerous, mostly unneeded completion jobs.onComplete
option insend()
andinsert()
has been removedonComplete()
,offComplete()
, andfetchCompleted()
have been removeddeadLetter
option added tosend()
andinsert()
andcreateQueue()
-
MAJOR: Dropped the following API functions in favor of policy queues
sendOnce()
sendSingleton()
-
MAJOR: Postgres 12 is now the minimum required version
-
MAJOR: Node 18 is now the minimum required version
-
MINOR:
send()
andinsert()
cascade configuration from policy queues (if they exist) and then global settings in the constructor. Use the following table to help identify which settings are inherited and when.Setting API Queue Constructor retryLimit
send()
,insert()
,createQueue()
✔️ ✔️ retryDelay
send()
,insert()
,createQueue()
✔️ ✔️ retryBackoff
send()
,insert()
,createQueue()
✔️ ✔️ expireInSeconds
send()
,insert()
,createQueue()
✔️ ✔️ expireInMinutes
send()
,createQueue()
✔️ ✔️ expireInHours
send()
,createQueue()
✔️ ✔️ retentionSeconds
send()
,createQueue()
✔️ ✔️ retentionMinutes
send()
,createQueue()
✔️ ✔️ retentionHours
send()
,createQueue()
✔️ ✔️ retentionDays
send()
,createQueue()
✔️ ✔️ deadLetter
send()
,insert()
,createQueue()
✔️ -
MINOR: Added primary key to job archive to support replication use cases such as read replicas or high availability standbys.
-
Existing archive table will be renamed to archive_backup and kept until the next release of pgboss, at which event it will be removed. This is only to make sure the automatic schema migration is fast. If you no longer need the jobs in archive and it's blocking you from replication, you can run the following to drop it.
DROP TABLE archive_backup
-
-
MINOR: Added a new constructor option,
migrate:false
, to block an instance from attempting to migrate to the latest database schema version. This is useful if the configured credentials don't have schema modification privileges or complete control of when and how migrations are run is required. -
MINOR:
noSupervisor
andnoScheduling
were renamed to a more intuitive naming convention.- If using
noSupervisor: true
to disable mainteance, instead usesupervise: false
- If using
noScheduling: true
to disable scheduled cron jobs, useschedule: false
- If using
-
MINOR: The
expired
failed state has been consolidated intofailed
for simplicity. -
MINOR: Added
priority:false
option towork()
andfetch()
to opt out of priority sorting during job fetching. If a queue is very large and not using the priority feature, this may help job fetch performance. -
MINOR: Added a manual maintenance API if desired:
maintain()
. -
MINOR:
stop()
will now wait for the default graceful stop timeout (30s) before resolving its promise. Thestopped
event will still emit. If you want to the original behavior, set the newwait
option tofalse
. -
MINOR: Added
id
property as an option tosend()
for pre-assigning the job id. Previously, onlyinsert()
supported pre-assignment.
9.0.3
9.0.2
What's Changed
- Update Typescript types for work() handler
- Update SKIP LOCKED link in README by @jleverenz in #397
- fix: add work overloads fix batchSize typing by @nomocas in #402
- GitHub Actions CI by @timgit in #407
- fix: start state handling by @simoneb in #406
New Contributors
- @jleverenz made their first contribution in #397
- @nomocas made their first contribution in #402
- @simoneb made their first contribution in #406
Full Changelog: 9.0.1...9.0.2
9.0.1
- Fixed Typescript type for work() async handler
Full Changelog: 9.0.0...9.0.1
9.0.0
What's Changed
- MAJOR: Limit 1 active singleton queue job by @adamhamlin in #368 (requires pg 11)
- MAJOR: Removed
job.done()
callback to standardize on async functions forwork()
- MINOR: All jobs returned in
work()
using thebatchSize
option are now auto-completed once the handler resolves - MAJOR: Node 16 is now the minimum required version
- MAJOR: PostgreSql 11 is now the minimum required version
Full Changelog: 8.4.2...9.0.0
8.4.2
What's Changed
- Prevent node from dying when DB unavailable by wrapping
getMaintenanceTime
by @shayneczyzewski in #374 - Meta monitor error handling by @timgit in #375
New Contributors
- @shayneczyzewski made their first contribution in #374
Full Changelog: 8.4.1...8.4.2
8.4.1
8.4.0
What's Changed
- Adds "archiveFailedAfterSeconds" option by @klesgidis in #364
- Failed archive config by @timgit in #366
Full Changelog: 8.3.1...8.4.0
8.3.1
- Stop maintenance jobs before shut down when workers don't stop within the grace period
- Update deps
Full Changelog: 8.3.0...8.3.1
8.3.0
- Added
destroy
option for connection pool management duringstop()
. PR #358 from @abelsoares