pg-boss 10.0.4 → 10.0.6
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/attorney.js +1 -1
- package/src/boss.js +1 -1
- package/src/contractor.js +10 -11
- package/src/db.js +1 -1
- package/src/index.js +1 -1
- package/src/manager.js +3 -3
- package/src/migrationStore.js +12 -1
- package/src/plans.js +2 -2
- package/src/timekeeper.js +2 -2
- package/src/tools.js +1 -1
- package/version.json +1 -1
package/package.json
CHANGED
package/src/attorney.js
CHANGED
package/src/boss.js
CHANGED
package/src/contractor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const assert = require('assert')
|
|
1
|
+
const assert = require('node:assert')
|
|
2
2
|
const plans = require('./plans')
|
|
3
3
|
const { DEFAULT_SCHEMA } = plans
|
|
4
4
|
const migrationStore = require('./migrationStore')
|
|
@@ -46,8 +46,7 @@ class Contractor {
|
|
|
46
46
|
const version = await this.schemaVersion()
|
|
47
47
|
|
|
48
48
|
if (schemaVersion > version) {
|
|
49
|
-
|
|
50
|
-
// await this.migrate(version)
|
|
49
|
+
await this.migrate(version)
|
|
51
50
|
}
|
|
52
51
|
} else {
|
|
53
52
|
await this.create()
|
|
@@ -86,15 +85,15 @@ class Contractor {
|
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
async next (version) {
|
|
89
|
+
const commands = migrationStore.next(this.config.schema, version, this.migrations)
|
|
90
|
+
await this.db.executeSql(commands)
|
|
91
|
+
}
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
async rollback (version) {
|
|
94
|
+
const commands = migrationStore.rollback(this.config.schema, version, this.migrations)
|
|
95
|
+
await this.db.executeSql(commands)
|
|
96
|
+
}
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
module.exports = Contractor
|
package/src/db.js
CHANGED
package/src/index.js
CHANGED
package/src/manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const assert = require('assert')
|
|
2
|
-
const EventEmitter = require('events')
|
|
3
|
-
const { randomUUID } = require('crypto')
|
|
1
|
+
const assert = require('node:assert')
|
|
2
|
+
const EventEmitter = require('node:events')
|
|
3
|
+
const { randomUUID } = require('node:crypto')
|
|
4
4
|
const { serializeError: stringify } = require('serialize-error')
|
|
5
5
|
const { delay } = require('./tools')
|
|
6
6
|
const Attorney = require('./attorney')
|
package/src/migrationStore.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const assert = require('assert')
|
|
1
|
+
const assert = require('node:assert')
|
|
2
2
|
const plans = require('./plans')
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
@@ -64,5 +64,16 @@ function migrate (value, version, migrations) {
|
|
|
64
64
|
|
|
65
65
|
function getAll (schema) {
|
|
66
66
|
return [
|
|
67
|
+
{
|
|
68
|
+
release: '10.0.6',
|
|
69
|
+
version: 22,
|
|
70
|
+
previous: 21,
|
|
71
|
+
install: [
|
|
72
|
+
`ALTER TABLE ${schema}.job ALTER COLUMN retry_limit SET DEFAULT 2`
|
|
73
|
+
],
|
|
74
|
+
uninstall: [
|
|
75
|
+
`ALTER TABLE ${schema}.job ALTER COLUMN retry_limit SET DEFAULT 0`
|
|
76
|
+
]
|
|
77
|
+
}
|
|
67
78
|
]
|
|
68
79
|
}
|
package/src/plans.js
CHANGED
|
@@ -65,7 +65,7 @@ module.exports = {
|
|
|
65
65
|
DEFAULT_SCHEMA
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const assert = require('assert')
|
|
68
|
+
const assert = require('node:assert')
|
|
69
69
|
|
|
70
70
|
function create (schema, version) {
|
|
71
71
|
const commands = [
|
|
@@ -179,7 +179,7 @@ function createTableJob (schema) {
|
|
|
179
179
|
priority integer not null default(0),
|
|
180
180
|
data jsonb,
|
|
181
181
|
state ${schema}.job_state not null default('${JOB_STATES.created}'),
|
|
182
|
-
retry_limit integer not null default(
|
|
182
|
+
retry_limit integer not null default(2),
|
|
183
183
|
retry_count integer not null default(0),
|
|
184
184
|
retry_delay integer not null default(0),
|
|
185
185
|
retry_backoff boolean not null default false,
|
package/src/timekeeper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const EventEmitter = require('events')
|
|
1
|
+
const EventEmitter = require('node:events')
|
|
2
2
|
const plans = require('./plans')
|
|
3
3
|
const cronParser = require('cron-parser')
|
|
4
4
|
const Attorney = require('./attorney')
|
|
@@ -144,7 +144,7 @@ class Timekeeper extends EventEmitter {
|
|
|
144
144
|
const scheduled = schedules
|
|
145
145
|
.filter(i => this.shouldSendIt(i.cron, i.timezone))
|
|
146
146
|
.map(({ name, data, options }) =>
|
|
147
|
-
({ name: QUEUES.SEND_IT, data: { name, data, options },
|
|
147
|
+
({ name: QUEUES.SEND_IT, data: { name, data, options }, singletonKey: name, singletonSeconds: 60 }))
|
|
148
148
|
|
|
149
149
|
if (scheduled.length > 0 && !this.stopped) {
|
|
150
150
|
await this.manager.insert(scheduled)
|
package/src/tools.js
CHANGED
package/version.json
CHANGED