pg-boss 11.0.1 → 11.0.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  Queueing jobs in Postgres from Node.js like a boss.
2
2
 
3
- [![npm version](https://badge.fury.io/js/pg-boss.svg)](https://badge.fury.io/js/pg-boss)
3
+ [![npm version](https://badge.fury.io/js/pg-boss.svg?icon=si%3Anpm)](https://badge.fury.io/js/pg-boss)
4
4
  [![Build](https://github.com/timgit/pg-boss/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/timgit/pg-boss/actions/workflows/ci.yml)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/timgit/pg-boss/badge.svg?branch=master)](https://coveralls.io/github/timgit/pg-boss?branch=master)
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-boss",
3
- "version": "11.0.1",
3
+ "version": "11.0.3",
4
4
  "description": "Queueing jobs in Postgres from Node.js like a boss",
5
5
  "main": "./src/index.js",
6
6
  "engines": {
package/src/attorney.js CHANGED
@@ -130,7 +130,7 @@ function getConfig (value) {
130
130
  config.migrate = ('migrate' in config) ? config.migrate : true
131
131
 
132
132
  applySchemaConfig(config)
133
- applyMaintenanceConfig(config)
133
+ applyOpsConfig(config)
134
134
  applyScheduleConfig(config)
135
135
  validateWarningConfig(config)
136
136
 
@@ -201,7 +201,15 @@ function applyPollingInterval (config) {
201
201
  : 2000
202
202
  }
203
203
 
204
- function applyMaintenanceConfig (config) {
204
+ function applyOpsConfig (config) {
205
+ assert(!('superviseIntervalSeconds' in config) || config.superviseIntervalSeconds >= 1,
206
+ 'configuration assert: superviseIntervalSeconds must be at least every second')
207
+
208
+ config.superviseIntervalSeconds = config.superviseIntervalSeconds || 60
209
+
210
+ assert(config.superviseIntervalSeconds / 60 / 60 <= POLICY.MAX_EXPIRATION_HOURS,
211
+ `configuration assert: superviseIntervalSeconds cannot exceed ${POLICY.MAX_EXPIRATION_HOURS} hours`)
212
+
205
213
  assert(!('maintenanceIntervalSeconds' in config) || config.maintenanceIntervalSeconds >= 1,
206
214
  'configuration assert: maintenanceIntervalSeconds must be at least every second')
207
215
 
package/src/plans.js CHANGED
@@ -697,7 +697,7 @@ function insertJobs (schema, { table, name, returnId = true }) {
697
697
  j.start_after,
698
698
  "singletonKey",
699
699
  CASE
700
- WHEN "singletonSeconds" IS NOT NULL THEN 'epoch'::timestamp + '1s'::interval * ("singletonSeconds" * floor(( date_part('epoch', now()) + "singletonOffset") / "singletonSeconds" ))
700
+ WHEN "singletonSeconds" IS NOT NULL THEN 'epoch'::timestamp + '1s'::interval * ("singletonSeconds" * floor(( date_part('epoch', now()) + COALESCE("singletonOffset",0)) / "singletonSeconds" ))
701
701
  ELSE NULL
702
702
  END as singleton_on,
703
703
  COALESCE("expireInSeconds", q.expire_seconds) as expire_seconds,