@midwayjs/bull 3.11.0 → 3.11.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/dist/decorator.d.ts +3 -3
- package/dist/decorator.js +4 -2
- package/dist/framework.js +4 -2
- package/package.json +4 -4
package/dist/decorator.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JobOptions } from 'bull';
|
|
2
|
-
export declare function Processor(queueName: string, jobOptions?: JobOptions): ClassDecorator;
|
|
3
|
-
export declare function Processor(queueName: string, concurrency?: number, jobOptions?: JobOptions): ClassDecorator;
|
|
1
|
+
import { JobOptions, QueueOptions } from 'bull';
|
|
2
|
+
export declare function Processor(queueName: string, jobOptions?: JobOptions, queueOptions?: QueueOptions): ClassDecorator;
|
|
3
|
+
export declare function Processor(queueName: string, concurrency?: number, jobOptions?: JobOptions, queueOptions?: QueueOptions): ClassDecorator;
|
|
4
4
|
export declare function InjectQueue(queueName: string): PropertyDecorator;
|
|
5
5
|
//# sourceMappingURL=decorator.d.ts.map
|
package/dist/decorator.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InjectQueue = exports.Processor = void 0;
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
-
function Processor(queueName, concurrency, jobOptions) {
|
|
6
|
+
function Processor(queueName, concurrency, jobOptions, queueOptions) {
|
|
7
7
|
return function (target) {
|
|
8
8
|
if (typeof concurrency !== 'number') {
|
|
9
|
-
|
|
9
|
+
queueOptions = { ...jobOptions };
|
|
10
|
+
jobOptions = { ...concurrency };
|
|
10
11
|
concurrency = 1;
|
|
11
12
|
}
|
|
12
13
|
(0, core_1.saveModule)(constants_1.BULL_PROCESSOR_KEY, target);
|
|
@@ -14,6 +15,7 @@ function Processor(queueName, concurrency, jobOptions) {
|
|
|
14
15
|
queueName,
|
|
15
16
|
concurrency,
|
|
16
17
|
jobOptions,
|
|
18
|
+
queueOptions,
|
|
17
19
|
}, target);
|
|
18
20
|
(0, core_1.Provide)()(target);
|
|
19
21
|
(0, core_1.Scope)(core_1.ScopeEnum.Request)(target);
|
package/dist/framework.js
CHANGED
|
@@ -42,12 +42,14 @@ let BullFramework = class BullFramework extends core_1.BaseFramework {
|
|
|
42
42
|
return 'bull';
|
|
43
43
|
}
|
|
44
44
|
async run() {
|
|
45
|
-
var _a, _b;
|
|
45
|
+
var _a, _b, _c;
|
|
46
46
|
const processorModules = (0, core_1.listModule)(constants_1.BULL_PROCESSOR_KEY);
|
|
47
47
|
for (const mod of processorModules) {
|
|
48
48
|
const options = (0, core_1.getClassMetadata)(constants_1.BULL_PROCESSOR_KEY, mod);
|
|
49
49
|
const { repeat, delay, ...otherOptions } = (_a = options.jobOptions) !== null && _a !== void 0 ? _a : {};
|
|
50
|
+
const queueOptions = (_b = options.queueOptions) !== null && _b !== void 0 ? _b : {};
|
|
50
51
|
const currentQueue = this.ensureQueue(options.queueName, {
|
|
52
|
+
...queueOptions,
|
|
51
53
|
defaultJobOptions: otherOptions,
|
|
52
54
|
});
|
|
53
55
|
// clear old repeat job when start
|
|
@@ -58,7 +60,7 @@ let BullFramework = class BullFramework extends core_1.BaseFramework {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
await this.addProcessor(mod, options.queueName, options.concurrency);
|
|
61
|
-
if ((
|
|
63
|
+
if ((_c = options.jobOptions) === null || _c === void 0 ? void 0 : _c.repeat) {
|
|
62
64
|
await this.runJob(options.queueName, {}, options.jobOptions);
|
|
63
65
|
}
|
|
64
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/bull",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.1",
|
|
4
4
|
"description": "midway component for bull",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@midwayjs/core": "^3.11.
|
|
28
|
-
"@midwayjs/mock": "^3.11.
|
|
27
|
+
"@midwayjs/core": "^3.11.1",
|
|
28
|
+
"@midwayjs/mock": "^3.11.1"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"bull": "4.10.4"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=12"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "bd9375874eb8cfaa49fbcfaa0497021cea06a394"
|
|
37
37
|
}
|