pg-boss 10.0.0-beta20 → 10.0.0-beta21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/package.json +1 -1
- package/src/index.js +2 -2
- package/src/plans.js +1 -1
- package/types.d.ts +5 -5
package/README.md
CHANGED
|
@@ -27,20 +27,21 @@ async function readme() {
|
|
|
27
27
|
|
|
28
28
|
pg-boss is a job queue built in Node.js on top of PostgreSQL in order to provide background processing and reliable asynchronous execution to Node.js applications.
|
|
29
29
|
|
|
30
|
-
pg-boss relies on [SKIP LOCKED](https://www.2ndquadrant.com/en/blog/what-is-select-skip-locked-for-in-postgresql-9-5/), a feature
|
|
30
|
+
pg-boss relies on [SKIP LOCKED](https://www.2ndquadrant.com/en/blog/what-is-select-skip-locked-for-in-postgresql-9-5/), a feature built specifically for message queues to resolve record locking challenges inherent with relational databases. This provides exactly-once delivery and the safety of guaranteed atomic commits to asynchronous job processing.
|
|
31
31
|
|
|
32
32
|
This will likely cater the most to teams already familiar with the simplicity of relational database semantics and operations (SQL, querying, and backups). It will be especially useful to those already relying on PostgreSQL that want to limit how many systems are required to monitor and support in their architecture.
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Summary
|
|
36
36
|
* Exactly-once job delivery
|
|
37
37
|
* Backpressure-compatible polling workers
|
|
38
38
|
* Cron scheduling
|
|
39
|
+
* Queue storage policies to support a variety of rate limiting, debouncing, and concurrency use cases
|
|
40
|
+
* Priority queues, dead letter queues, job deferral, automatic retries with exponential backoff
|
|
39
41
|
* Pub/sub API for fan-out queue relationships
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
+
* Raw SQL support for non-Node.js runtimes via INSERT or COPY
|
|
43
|
+
* Serverless function compatible
|
|
42
44
|
* Multi-master compatible (for example, in a Kubernetes ReplicaSet)
|
|
43
|
-
* Dead letter queues
|
|
44
45
|
|
|
45
46
|
## Requirements
|
|
46
47
|
* Node 20 or higher
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -149,7 +149,7 @@ class PgBoss extends EventEmitter {
|
|
|
149
149
|
return
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
let {
|
|
152
|
+
let { close = true, graceful = true, timeout = 30000, wait = true } = options
|
|
153
153
|
|
|
154
154
|
timeout = Math.max(timeout, 1000)
|
|
155
155
|
|
|
@@ -168,7 +168,7 @@ class PgBoss extends EventEmitter {
|
|
|
168
168
|
|
|
169
169
|
await this.#manager.failWip()
|
|
170
170
|
|
|
171
|
-
if (this.#db.isOurs && this.#db.opened &&
|
|
171
|
+
if (this.#db.isOurs && this.#db.opened && close) {
|
|
172
172
|
await this.#db.close()
|
|
173
173
|
}
|
|
174
174
|
|
package/src/plans.js
CHANGED
package/types.d.ts
CHANGED
|
@@ -242,7 +242,7 @@ declare namespace PgBoss {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
interface StopOptions {
|
|
245
|
-
|
|
245
|
+
close?: boolean,
|
|
246
246
|
graceful?: boolean,
|
|
247
247
|
timeout?: number,
|
|
248
248
|
wait?: boolean
|
|
@@ -343,15 +343,15 @@ declare class PgBoss extends EventEmitter {
|
|
|
343
343
|
fail(name: string, id: string, data: object, options?: PgBoss.ConnectionOptions): Promise<void>;
|
|
344
344
|
fail(name: string, ids: string[], options?: PgBoss.ConnectionOptions): Promise<void>;
|
|
345
345
|
|
|
346
|
-
getQueueSize(name: string, options?: object): Promise<number>;
|
|
347
346
|
getJobById(name: string, id: string, options?: PgBoss.ConnectionOptions & { includeArchive: bool }): Promise<PgBoss.JobWithMetadata | null>;
|
|
348
|
-
|
|
347
|
+
|
|
349
348
|
createQueue(name: string, options?: PgBoss.Queue): Promise<void>;
|
|
350
|
-
getQueue(name: string): Promise<PgBoss.Queue | null>;
|
|
351
|
-
getQueues(): Promise<PgBoss.QueueResult[]>;
|
|
352
349
|
updateQueue(name: string, options?: PgBoss.Queue): Promise<void>;
|
|
353
350
|
deleteQueue(name: string): Promise<void>;
|
|
354
351
|
purgeQueue(name: string): Promise<void>;
|
|
352
|
+
getQueues(): Promise<PgBoss.QueueResult[]>;
|
|
353
|
+
getQueue(name: string): Promise<PgBoss.QueueResult | null>;
|
|
354
|
+
getQueueSize(name: string, options?: { before: 'retry' | 'active' | 'completed' | 'cancelled' | 'failed' }): Promise<number>;
|
|
355
355
|
|
|
356
356
|
clearStorage(): Promise<void>;
|
|
357
357
|
archive(): Promise<void>;
|