@pikku/queue-bullmq 0.9.2 → 0.9.4
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/CHANGELOG.md +16 -0
- package/package.json +2 -2
- package/src/bull-queue-worker.ts +29 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pikku/queue-bullmq
|
|
2
2
|
|
|
3
|
+
## 0.9.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3bb5824: fix: forcing release to see if dist is generated
|
|
8
|
+
- Updated dependencies [99c2b3a]
|
|
9
|
+
- @pikku/core@0.9.9
|
|
10
|
+
|
|
11
|
+
## 0.9.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c18800d: feat: adding queue and scheduledTask to interactions
|
|
16
|
+
- Updated dependencies [c18800d]
|
|
17
|
+
- @pikku/core@0.9.4
|
|
18
|
+
|
|
3
19
|
## 0.9.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/queue-bullmq",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"release": "npm run build && npm test"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@pikku/core": "^0.9.
|
|
16
|
+
"@pikku/core": "^0.9.9"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"bullmq": "^5.57.0",
|
package/src/bull-queue-worker.ts
CHANGED
|
@@ -10,7 +10,12 @@ import type {
|
|
|
10
10
|
QueueConfigMapping,
|
|
11
11
|
ConfigValidationResult,
|
|
12
12
|
} from '@pikku/core/queue'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
runQueueJob,
|
|
15
|
+
registerQueueWorkers,
|
|
16
|
+
QueueJobFailedError,
|
|
17
|
+
QueueJobDiscardedError,
|
|
18
|
+
} from '@pikku/core/queue'
|
|
14
19
|
import {
|
|
15
20
|
CoreServices,
|
|
16
21
|
CoreSingletonServices,
|
|
@@ -158,15 +163,29 @@ export class BullQueueWorkers implements QueueWorkers {
|
|
|
158
163
|
const worker = new Worker(
|
|
159
164
|
processor.queueName,
|
|
160
165
|
async (job: Bull.Job) => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
job
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
try {
|
|
167
|
+
return await runQueueJob({
|
|
168
|
+
singletonServices: this.singletonServices,
|
|
169
|
+
createSessionServices: this.createSessionServices,
|
|
170
|
+
job: await mapBullJobToQueueJob(
|
|
171
|
+
job,
|
|
172
|
+
this.redisConnectionOptions,
|
|
173
|
+
this.queueEvents
|
|
174
|
+
),
|
|
175
|
+
updateProgress: async (progress) => {
|
|
176
|
+
await job.updateProgress(progress)
|
|
177
|
+
},
|
|
178
|
+
})
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (error instanceof QueueJobFailedError) {
|
|
181
|
+
// Let BullMQ handle this as a failed job
|
|
182
|
+
throw new Error(error.message)
|
|
183
|
+
} else if (error instanceof QueueJobDiscardedError) {
|
|
184
|
+
return // Don't throw, job is discarded, which I guess is considered
|
|
185
|
+
// a successful job removal
|
|
186
|
+
}
|
|
187
|
+
throw error
|
|
188
|
+
}
|
|
170
189
|
},
|
|
171
190
|
{
|
|
172
191
|
connection: this.redisConnectionOptions,
|