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 +1 -1
- package/src/index.js +6 -1
- package/types.d.ts +1 -0
package/package.json
CHANGED
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)
|