@pikku/queue-bullmq 0.9.1 → 0.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @pikku/queue-bullmq
2
2
 
3
+ ## 0.9.3
4
+
5
+ ### Patch Changes
6
+
7
+ - c18800d: feat: adding queue and scheduledTask to interactions
8
+ - Updated dependencies [c18800d]
9
+ - @pikku/core@0.9.4
10
+
11
+ ## 0.9.2
12
+
13
+ ### Patch Changes
14
+
15
+ - a5905a9: chore: updating all dependencies
16
+ - Updated dependencies [1256238]
17
+ - Updated dependencies [6cf8efd]
18
+ - Updated dependencies [d3a9a09]
19
+ - Updated dependencies [840e078]
20
+ - Updated dependencies [667d23c]
21
+ - Updated dependencies [a5905a9]
22
+ - @pikku/core@0.9.2
23
+
3
24
  ## 0.9.1
4
25
 
5
26
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/queue-bullmq",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -13,13 +13,13 @@
13
13
  "release": "npm run build && npm test"
14
14
  },
15
15
  "peerDependencies": {
16
- "@pikku/core": "^0.9.1"
16
+ "@pikku/core": "^0.9.4"
17
17
  },
18
18
  "dependencies": {
19
- "bullmq": "^5.56.0",
20
- "ioredis": "^5.6.1"
19
+ "bullmq": "^5.57.0",
20
+ "ioredis": "^5.7.0"
21
21
  },
22
22
  "devDependencies": {
23
- "typescript": "^5.6"
23
+ "typescript": "^5.9"
24
24
  }
25
25
  }
@@ -10,7 +10,12 @@ import type {
10
10
  QueueConfigMapping,
11
11
  ConfigValidationResult,
12
12
  } from '@pikku/core/queue'
13
- import { runQueueJob, registerQueueWorkers } from '@pikku/core/queue'
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
- return await runQueueJob({
162
- singletonServices: this.singletonServices,
163
- createSessionServices: this.createSessionServices,
164
- job: await mapBullJobToQueueJob(
165
- job,
166
- this.redisConnectionOptions,
167
- this.queueEvents
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,