vona-module-a-queue 5.0.26 → 5.0.28
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/index.js +6 -2
- package/dist/service/queue.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { BeanInfo, BeanBase, uuidv4, deepExtend, instanceDesp, beanFullNameFromO
|
|
|
2
2
|
import { sleep } from '@cabloy/utils';
|
|
3
3
|
import * as Bull from 'bullmq';
|
|
4
4
|
import { Service, Scope } from 'vona-module-a-bean';
|
|
5
|
+
import { getRedisClientKeyPrefix } from 'vona-module-a-redis';
|
|
5
6
|
import { Startup } from 'vona-module-a-startup';
|
|
6
7
|
|
|
7
8
|
var _dec$2, _dec2$2, _class$2;
|
|
@@ -51,12 +52,15 @@ let ServiceQueue = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
51
52
|
}
|
|
52
53
|
this._queues = {};
|
|
53
54
|
}
|
|
55
|
+
_getPrefix() {
|
|
56
|
+
return `${getRedisClientKeyPrefix('bull', this.app)}queue`;
|
|
57
|
+
}
|
|
54
58
|
_createWorker(info, queueKey) {
|
|
55
59
|
const app = this.app;
|
|
56
60
|
// worker
|
|
57
61
|
const _worker = {};
|
|
58
62
|
// prefix
|
|
59
|
-
const prefix =
|
|
63
|
+
const prefix = this._getPrefix();
|
|
60
64
|
// queue config
|
|
61
65
|
const queueConfig = app.bean.onion.queue.getOnionOptions(info.queueName);
|
|
62
66
|
// queueConfig.options: queue/worker/job/redlock
|
|
@@ -116,7 +120,7 @@ let ServiceQueue = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
116
120
|
// queue
|
|
117
121
|
const _queue = {};
|
|
118
122
|
// prefix
|
|
119
|
-
const prefix =
|
|
123
|
+
const prefix = this._getPrefix();
|
|
120
124
|
// queue config
|
|
121
125
|
const queueConfig = app.bean.onion.queue.getOnionOptions(info.queueName);
|
|
122
126
|
// queueConfig.options: queue/worker/job/limiter
|
package/dist/service/queue.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class ServiceQueue extends BeanBase {
|
|
|
11
11
|
loadQueueWorkers(instanceName?: keyof IInstanceRecord | undefined | null): void;
|
|
12
12
|
clearWorkers(): Promise<void>;
|
|
13
13
|
clearQueues(): Promise<void>;
|
|
14
|
+
_getPrefix(): string;
|
|
14
15
|
_createWorker<DATA>(info: IQueueJobContext<DATA>, queueKey: string): IQueueWork;
|
|
15
16
|
_createQueue<DATA>(info: IQueueJobContext<DATA>, queueKey: string): IQueueQueue;
|
|
16
17
|
_ensureWorker<DATA>(info: IQueueJobContext<DATA>): void;
|