more lint fixes
This commit is contained in:
parent
3e545cdaa9
commit
67c073e4f2
7 changed files with 29 additions and 15 deletions
|
|
@ -35,7 +35,9 @@ export class QueueManager {
|
|||
if (config.rateLimitRules && config.rateLimitRules.length > 0) {
|
||||
this.rateLimiter = new QueueRateLimiter(this.redisConnection);
|
||||
config.rateLimitRules.forEach(rule => {
|
||||
this.rateLimiter!.addRule(rule);
|
||||
if (this.rateLimiter) {
|
||||
this.rateLimiter.addRule(rule);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +115,10 @@ export class QueueManager {
|
|||
getQueue(queueName: string, options: QueueOptions = {}): Queue {
|
||||
// Return existing queue if it exists
|
||||
if (this.queues.has(queueName)) {
|
||||
return this.queues.get(queueName)!;
|
||||
const existingQueue = this.queues.get(queueName);
|
||||
if (existingQueue) {
|
||||
return existingQueue;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new queue with merged options
|
||||
|
|
@ -147,7 +152,9 @@ export class QueueManager {
|
|||
mergedOptions.rateLimitRules.forEach(rule => {
|
||||
// Ensure queue name is set for queue-specific rules
|
||||
const ruleWithQueue = { ...rule, queueName };
|
||||
this.rateLimiter!.addRule(ruleWithQueue);
|
||||
if (this.rateLimiter) {
|
||||
this.rateLimiter.addRule(ruleWithQueue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +195,11 @@ export class QueueManager {
|
|||
this.caches.set(queueName, cacheProvider);
|
||||
logger.trace('Cache created for queue', { queueName });
|
||||
}
|
||||
return this.caches.get(queueName)!;
|
||||
const cache = this.caches.get(queueName);
|
||||
if (!cache) {
|
||||
throw new Error(`Expected cache for queue ${queueName} to exist`);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue