pg-boss 8.2.0 → 8.3.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-boss",
3
- "version": "8.2.0",
3
+ "version": "8.3.1",
4
4
  "description": "Queueing jobs in Node.js using PostgreSQL like a boss",
5
5
  "main": "./src/index.js",
6
6
  "engines": {
package/src/index.js CHANGED
@@ -126,7 +126,7 @@ class PgBoss extends EventEmitter {
126
126
  this.emit(events.stopped)
127
127
  }
128
128
 
129
- let { graceful = true, timeout = 30000 } = options
129
+ let { destroy = false, graceful = true, timeout = 30000 } = options
130
130
 
131
131
  timeout = Math.max(timeout, 1000)
132
132
 
@@ -139,6 +139,10 @@ class PgBoss extends EventEmitter {
139
139
  this.stopped = true
140
140
  this.stoppingOn = null
141
141
 
142
+ if (this.db.isOurs && this.db.opened && destroy) {
143
+ await this.db.close()
144
+ }
145
+
142
146
  this.emit(events.stopped)
143
147
  }
144
148
 
@@ -166,6 +170,7 @@ class PgBoss extends EventEmitter {
166
170
  await delay(1000)
167
171
  }
168
172
 
173
+ await this.boss.stop()
169
174
  await shutdown()
170
175
  } catch (err) {
171
176
  this.emit(events.error, err)
package/types.d.ts CHANGED
@@ -242,6 +242,7 @@ declare namespace PgBoss {
242
242
  }
243
243
 
244
244
  interface StopOptions {
245
+ destroy?: boolean,
245
246
  graceful?: boolean,
246
247
  timeout?: number
247
248
  }