more lint fixes
This commit is contained in:
parent
3e545cdaa9
commit
67c073e4f2
7 changed files with 29 additions and 15 deletions
|
|
@ -98,11 +98,11 @@ export class ConfigManager<T = Record<string, unknown>> {
|
|||
getValue<R = unknown>(path: string): R {
|
||||
const config = this.get();
|
||||
const keys = path.split('.');
|
||||
let value: any = config;
|
||||
let value: unknown = config;
|
||||
|
||||
for (const key of keys) {
|
||||
if (value && typeof value === 'object' && key in value) {
|
||||
value = value[key];
|
||||
value = (value as Record<string, unknown>)[key];
|
||||
} else {
|
||||
throw new ConfigError(`Configuration key not found: ${path}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export function getProviderConfig(provider: string) {
|
|||
if (!providers || !(provider in providers)) {
|
||||
throw new Error(`Provider configuration not found: ${provider}`);
|
||||
}
|
||||
return (providers as any)[provider];
|
||||
return (providers as Record<string, unknown>)[provider];
|
||||
}
|
||||
|
||||
// Export environment helpers
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export class FileLoader implements ConfigLoader {
|
|||
try {
|
||||
const content = await readFile(filepath, 'utf-8');
|
||||
return JSON.parse(content);
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
// File not found is not an error (configs are optional)
|
||||
if (error.code === 'ENOENT') {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export class PostgreSQLClient {
|
|||
|
||||
let lastError: Error | null = null;
|
||||
|
||||
for (let attempt = 1; attempt <= this.options.retryAttempts!; attempt++) {
|
||||
for (let attempt = 1; attempt <= (this.options.retryAttempts ?? 3); attempt++) {
|
||||
try {
|
||||
this.logger.info(
|
||||
`Connecting to PostgreSQL (attempt ${attempt}/${this.options.retryAttempts})...`
|
||||
|
|
@ -81,8 +81,8 @@ export class PostgreSQLClient {
|
|||
this.pool = null;
|
||||
}
|
||||
|
||||
if (attempt < this.options.retryAttempts!) {
|
||||
await this.delay(this.options.retryDelay! * attempt);
|
||||
if (attempt < (this.options.retryAttempts ?? 3)) {
|
||||
await this.delay((this.options.retryDelay ?? 1000) * attempt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ export class PostgreSQLHealthMonitor {
|
|||
if (!this.lastHealthCheck) {
|
||||
await this.performHealthCheck();
|
||||
}
|
||||
return this.lastHealthCheck!;
|
||||
if (!this.lastHealthCheck) {
|
||||
throw new Error('Health check failed to produce results');
|
||||
}
|
||||
return this.lastHealthCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export class QuestDBClient {
|
|||
|
||||
let lastError: Error | null = null;
|
||||
|
||||
for (let attempt = 1; attempt <= this.options.retryAttempts!; attempt++) {
|
||||
for (let attempt = 1; attempt <= (this.options.retryAttempts ?? 3); attempt++) {
|
||||
try {
|
||||
this.logger.info(
|
||||
`Connecting to QuestDB (attempt ${attempt}/${this.options.retryAttempts})...`
|
||||
|
|
@ -84,8 +84,8 @@ export class QuestDBClient {
|
|||
this.pgPool = null;
|
||||
}
|
||||
|
||||
if (attempt < this.options.retryAttempts!) {
|
||||
await this.delay(this.options.retryDelay! * attempt);
|
||||
if (attempt < (this.options.retryAttempts ?? 3)) {
|
||||
await this.delay((this.options.retryDelay ?? 1000) * attempt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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