small
This commit is contained in:
parent
8a1a28b26e
commit
d76f0ff5ff
3 changed files with 22 additions and 16 deletions
|
|
@ -75,11 +75,13 @@ export class QueueManager {
|
|||
};
|
||||
|
||||
// Prepare queue configuration
|
||||
const workers = mergedOptions.workers ?? this.config.defaultQueueOptions?.workers ?? 1;
|
||||
const concurrency = mergedOptions.concurrency ?? this.config.defaultQueueOptions?.concurrency ?? 1;
|
||||
|
||||
const queueConfig: QueueWorkerConfig = {
|
||||
workers: mergedOptions.workers,
|
||||
concurrency: mergedOptions.concurrency,
|
||||
startWorker:
|
||||
!!mergedOptions.workers && mergedOptions.workers > 0 && !this.config.delayWorkerStart,
|
||||
workers,
|
||||
concurrency,
|
||||
startWorker: workers > 0 && !this.config.delayWorkerStart,
|
||||
};
|
||||
|
||||
const queue = new Queue(
|
||||
|
|
@ -109,8 +111,8 @@ export class QueueManager {
|
|||
|
||||
this.logger.info('Queue created with batch cache', {
|
||||
queueName,
|
||||
workers: mergedOptions.workers || 0,
|
||||
concurrency: mergedOptions.concurrency || 1,
|
||||
workers: workers,
|
||||
concurrency: concurrency,
|
||||
});
|
||||
|
||||
return queue;
|
||||
|
|
@ -140,6 +142,7 @@ export class QueueManager {
|
|||
keyPrefix: `batch:${queueName}:`,
|
||||
ttl: 86400, // 24 hours default
|
||||
enableMetrics: true,
|
||||
logger: this.logger,
|
||||
});
|
||||
this.caches.set(queueName, cacheProvider);
|
||||
this.logger.trace('Cache created for queue', { queueName });
|
||||
|
|
@ -210,7 +213,7 @@ export class QueueManager {
|
|||
*/
|
||||
addRateLimitRule(rule: RateLimitRule): void {
|
||||
if (!this.rateLimiter) {
|
||||
this.rateLimiter = new QueueRateLimiter(this.redisConnection);
|
||||
this.rateLimiter = new QueueRateLimiter(this.redisConnection, this.logger);
|
||||
}
|
||||
this.rateLimiter.addRule(rule);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue