pg-boss 10.0.0-beta11 → 10.0.0-beta12
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/package.json +1 -1
- package/src/manager.js +9 -2
- package/src/plans.js +8 -3
- package/types.d.ts +1 -0
package/package.json
CHANGED
package/src/manager.js
CHANGED
|
@@ -58,6 +58,7 @@ class Manager extends EventEmitter {
|
|
|
58
58
|
this.getArchivedJobByIdCommand = plans.getArchivedJobById(config.schema)
|
|
59
59
|
this.subscribeCommand = plans.subscribe(config.schema)
|
|
60
60
|
this.unsubscribeCommand = plans.unsubscribe(config.schema)
|
|
61
|
+
this.getQueuesCommand = plans.getQueues(config.schema)
|
|
61
62
|
this.getQueuesForEventCommand = plans.getQueuesForEvent(config.schema)
|
|
62
63
|
|
|
63
64
|
// exported api to index
|
|
@@ -80,10 +81,11 @@ class Manager extends EventEmitter {
|
|
|
80
81
|
this.sendAfter,
|
|
81
82
|
this.createQueue,
|
|
82
83
|
this.updateQueue,
|
|
83
|
-
this.getQueue,
|
|
84
84
|
this.deleteQueue,
|
|
85
85
|
this.purgeQueue,
|
|
86
86
|
this.getQueueSize,
|
|
87
|
+
this.getQueue,
|
|
88
|
+
this.getQueues,
|
|
87
89
|
this.clearStorage,
|
|
88
90
|
this.getJobById
|
|
89
91
|
]
|
|
@@ -562,7 +564,7 @@ class Manager extends EventEmitter {
|
|
|
562
564
|
|
|
563
565
|
await this.db.executeSql(paritionSql)
|
|
564
566
|
|
|
565
|
-
const sql = plans.
|
|
567
|
+
const sql = plans.insertQueue(this.config.schema)
|
|
566
568
|
|
|
567
569
|
const params = [
|
|
568
570
|
name,
|
|
@@ -578,6 +580,11 @@ class Manager extends EventEmitter {
|
|
|
578
580
|
await this.db.executeSql(sql, params)
|
|
579
581
|
}
|
|
580
582
|
|
|
583
|
+
async getQueues () {
|
|
584
|
+
const { rows } = await this.db.executeSql(this.getQueuesCommand)
|
|
585
|
+
return rows
|
|
586
|
+
}
|
|
587
|
+
|
|
581
588
|
async updateQueue (name, options = {}) {
|
|
582
589
|
assert(name, 'Missing queue name argument')
|
|
583
590
|
|
package/src/plans.js
CHANGED
|
@@ -42,11 +42,12 @@ module.exports = {
|
|
|
42
42
|
archive,
|
|
43
43
|
drop,
|
|
44
44
|
countStates,
|
|
45
|
-
|
|
45
|
+
insertQueue,
|
|
46
46
|
updateQueue,
|
|
47
47
|
createPartition,
|
|
48
48
|
dropPartition,
|
|
49
49
|
deleteQueueRecords,
|
|
50
|
+
getQueues,
|
|
50
51
|
getQueueByName,
|
|
51
52
|
getQueueSize,
|
|
52
53
|
purgeQueue,
|
|
@@ -216,7 +217,7 @@ function dropPartitionFunction (schema) {
|
|
|
216
217
|
RETURNS VOID AS
|
|
217
218
|
$$
|
|
218
219
|
BEGIN
|
|
219
|
-
EXECUTE format('DROP TABLE IF EXISTS
|
|
220
|
+
EXECUTE format('DROP TABLE IF EXISTS ${schema}.%I', ${schema}.get_partition(queue_name));
|
|
220
221
|
END;
|
|
221
222
|
$$
|
|
222
223
|
LANGUAGE plpgsql;
|
|
@@ -289,7 +290,7 @@ function trySetTimestamp (schema, column) {
|
|
|
289
290
|
`
|
|
290
291
|
}
|
|
291
292
|
|
|
292
|
-
function
|
|
293
|
+
function insertQueue (schema) {
|
|
293
294
|
return `
|
|
294
295
|
INSERT INTO ${schema}.queue (name, policy, retry_limit, retry_delay, retry_backoff, expire_seconds, retention_minutes, dead_letter)
|
|
295
296
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
|
@@ -309,6 +310,10 @@ function updateQueue (schema) {
|
|
|
309
310
|
`
|
|
310
311
|
}
|
|
311
312
|
|
|
313
|
+
function getQueues (schema) {
|
|
314
|
+
return `SELECT * FROM ${schema}.queue`
|
|
315
|
+
}
|
|
316
|
+
|
|
312
317
|
function getQueueByName (schema) {
|
|
313
318
|
return `SELECT * FROM ${schema}.queue WHERE name = $1`
|
|
314
319
|
}
|
package/types.d.ts
CHANGED
|
@@ -370,6 +370,7 @@ declare class PgBoss extends EventEmitter {
|
|
|
370
370
|
|
|
371
371
|
createQueue(name: string, options?: PgBoss.Queue): Promise<void>;
|
|
372
372
|
getQueue(name: string): Promise<PgBoss.Queue | null>;
|
|
373
|
+
getQueues(): Promise<[PgBoss.Queue]>;
|
|
373
374
|
updateQueue(name: string, options?: PgBoss.QueueUpdateOptions): Promise<void>;
|
|
374
375
|
deleteQueue(name: string): Promise<void>;
|
|
375
376
|
purgeQueue(name: string): Promise<void>;
|