@pikku/queue-bullmq 0.12.4 → 0.12.5

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,3 +1,32 @@
1
+ ## 0.12.5
2
+
3
+ ### Patch Changes
4
+
5
+ - e3d4454: Add job groups, so one shared queue can stay fair without splitting into one
6
+ queue per producer.
7
+
8
+ A job may now carry `group: { id, tier }`, and a worker may cap how many jobs
9
+ of any one group run at once via `groupConcurrency`. On pg-boss this maps to
10
+ `localGroupConcurrency`, which excludes at-capacity groups from the fetch query
11
+ itself, so a capped group costs nothing rather than being fetched and restored.
12
+ BullMQ declares it unsupported (groups are a BullMQ Pro feature) — being
13
+ push-based, it can simply use a queue per group at no polling cost.
14
+
15
+ Workflow services accept a `queueStrategy`. The default `'per-workflow'` is
16
+ unchanged: every workflow gets its own `wf-orchestrator-*` / `wf-step-*` queue,
17
+ which is also what lets serverless providers deploy one unit per workflow. The
18
+ new `'shared-groups'` routes every workflow through the shared
19
+ orchestrator/step-worker queues and isolates them by group instead, so a
20
+ monolith runs one set of pollers rather than one per workflow — on a
21
+ pull-based backend with dozens of workflows that is the difference between
22
+ hundreds of poll loops and twenty. It is for single-process runtimes only; a
23
+ per-unit serverless deploy still needs the per-workflow queues to route to its
24
+ units.
25
+
26
+ - Updated dependencies [24252b8]
27
+ - Updated dependencies [e3d4454]
28
+ - @pikku/core@0.12.69
29
+
1
30
  ## 0.12.4
2
31
 
3
32
  ### Patch Changes
@@ -82,6 +82,10 @@ export class BullQueueWorkers {
82
82
  },
83
83
  // Configurations that are not supported
84
84
  unsupported: {
85
+ groupConcurrency: {
86
+ reason: 'Job groups are a BullMQ Pro feature, not available in BullMQ',
87
+ explanation: 'Give each group its own queue instead — BullMQ is push-based, so extra queues cost no polling',
88
+ },
85
89
  visibilityTimeout: {
86
90
  reason: 'Bull does not use visibility timeout',
87
91
  explanation: 'BullMQ locks jobs during processing instead of using visibility timeouts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/queue-bullmq",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "prepublishOnly": "yarn build"
16
16
  },
17
17
  "peerDependencies": {
18
- "@pikku/core": "^0.12.44"
18
+ "@pikku/core": "^0.12.69"
19
19
  },
20
20
  "dependencies": {
21
21
  "bullmq": "^5.70.1",
package/run-tests.sh CHANGED
@@ -1,5 +1,56 @@
1
1
  #!/bin/bash
2
- cd "$(dirname "$0")"
2
+
3
+ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
+ cd "$script_dir"
5
+
6
+ # Enable nullglob to handle cases where no files match the pattern
7
+ shopt -s nullglob
8
+
9
+ # Initialize variables for options
10
+ watch_mode=false
11
+ coverage_mode=false
12
+
13
+ # Parse command-line options
14
+ while [[ $# -gt 0 ]]; do
15
+ case $1 in
16
+ --watch)
17
+ watch_mode=true
18
+ shift
19
+ ;;
20
+ --coverage)
21
+ coverage_mode=true
22
+ shift
23
+ ;;
24
+ *)
25
+ echo "Unknown option: $1"
26
+ exit 1
27
+ ;;
28
+ esac
29
+ done
30
+
31
+ # Define the pattern to match your test files
32
+ pattern="src/*.test.ts"
33
+
34
+ # Expand the pattern into an array of files
3
35
  files=($(find src -type f -name "*.test.ts"))
4
- if [ ${#files[@]} -eq 0 ]; then echo "No test files found"; exit 0; fi
5
- node --import tsx --test "$@" "${files[@]}"
36
+
37
+ # Check if any files matched the pattern
38
+ if [ ${#files[@]} -eq 0 ]; then
39
+ echo "No test files found matching pattern: $pattern"
40
+ exit 0
41
+ fi
42
+
43
+ # Construct the node command
44
+ node_cmd=(node --import tsx --test)
45
+
46
+ # Append options based on flags
47
+ if [ "$watch_mode" = true ]; then
48
+ node_cmd+=(--watch)
49
+ fi
50
+
51
+ if [ "$coverage_mode" = true ]; then
52
+ node_cmd+=(--test-coverage-include="src/**/*.{ts,js}" --test-coverage-exclude="**/dist/**" --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info)
53
+ fi
54
+
55
+ # Execute the node command with the expanded list of files
56
+ "${node_cmd[@]}" "${files[@]}"
@@ -111,6 +111,11 @@ export class BullQueueWorkers implements QueueWorkers {
111
111
 
112
112
  // Configurations that are not supported
113
113
  unsupported: {
114
+ groupConcurrency: {
115
+ reason: 'Job groups are a BullMQ Pro feature, not available in BullMQ',
116
+ explanation:
117
+ 'Give each group its own queue instead — BullMQ is push-based, so extra queues cost no polling',
118
+ },
114
119
  visibilityTimeout: {
115
120
  reason: 'Bull does not use visibility timeout',
116
121
  explanation: