pg-boss 12.33.4 → 12.33.5
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/dist/boss.d.ts.map +1 -1
- package/dist/boss.js +7 -4
- package/package.json +1 -1
package/dist/boss.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boss.d.ts","sourceRoot":"","sources":["../src/boss.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAgHnC,cAAM,IAAK,SAAQ,YAAa,YAAW,KAAK,CAAC,WAAW;;IAsC1D,MAAM;;;MAAS;gBAGb,EAAE,EAAE,KAAK,CAAC,SAAS,EACnB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAK,CAAC,0BAA0B;IAa1C,IAAI,WAAW,IAAK,OAAO,CAE1B;IAEK,KAAK;IAaL,IAAI;IAmGJ,SAAS,CAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"boss.d.ts","sourceRoot":"","sources":["../src/boss.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAgHnC,cAAM,IAAK,SAAQ,YAAa,YAAW,KAAK,CAAC,WAAW;;IAsC1D,MAAM;;;MAAS;gBAGb,EAAE,EAAE,KAAK,CAAC,SAAS,EACnB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAK,CAAC,0BAA0B;IAa1C,IAAI,WAAW,IAAK,OAAO,CAE1B;IAEK,KAAK;IAaL,IAAI;IAmGJ,SAAS,CAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,gBAAgB;IAurBvF;;;;OAIG;IACG,kBAAkB,CAAE,OAAO,CAAC,EAAE,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAwB7E;AAED,eAAe,IAAI,CAAA"}
|
package/dist/boss.js
CHANGED
|
@@ -11,7 +11,7 @@ const events = {
|
|
|
11
11
|
// Default thresholds and warning messages
|
|
12
12
|
const WARNINGS = {
|
|
13
13
|
SLOW_QUERY: { seconds: 30, message: 'Warning: slow query. Your queues and/or database server should be reviewed' },
|
|
14
|
-
LARGE_QUEUE: { size: 10_000, message: 'Warning: large queue backlog
|
|
14
|
+
LARGE_QUEUE: { size: 10_000, message: 'Warning: large queue backlog' },
|
|
15
15
|
// No threshold constant: the trigger is measured, not configured. See #checkVacuum.
|
|
16
16
|
XMIN_HORIZON: { message: 'Warning: the database transaction horizon is pinned, so completed jobs cannot be cleaned up' },
|
|
17
17
|
AUTOVACUUM_DISABLED: { message: 'Warning: autovacuum is disabled, so nothing is reclaiming completed jobs' },
|
|
@@ -312,9 +312,12 @@ class Boss extends EventEmitter {
|
|
|
312
312
|
// Coerce with Number(): CockroachDB returns these integer columns as strings, so a bare `>`
|
|
313
313
|
// would compare lexicographically ("100" > "9" === false) and silently miss the backlog. On
|
|
314
314
|
// standard Postgres these are already numbers, so Number() is a no-op.
|
|
315
|
-
const warnings = rowsCacheStats
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
const warnings = rowsCacheStats
|
|
316
|
+
.map(i => ({ row: i, threshold: Number(i.warningQueueSize) || this.#largeQueueSize }))
|
|
317
|
+
.filter(({ row, threshold }) => Number(row.queuedCount) > threshold);
|
|
318
|
+
for (const { row, threshold } of warnings) {
|
|
319
|
+
await emitAndPersistWarning(this.#warningContext, WARNING_TYPES.QUEUE_BACKLOG, `${WARNINGS.LARGE_QUEUE.message}: queue "${row.name}" has ${Number(row.queuedCount)} jobs in the ` +
|
|
320
|
+
`created or retry state, over its warning threshold of ${threshold}. Your queue should be reviewed`, row);
|
|
318
321
|
}
|
|
319
322
|
}
|
|
320
323
|
if (this.#stopping)
|