fixed more lint issues

This commit is contained in:
Boki 2025-06-20 08:42:58 -04:00
parent 48503ce8d1
commit cc014de397
11 changed files with 42 additions and 11 deletions

View file

@ -42,7 +42,11 @@ export class RedisConnectionManager {
RedisConnectionManager.sharedConnections.set(name, connection);
this.logger.info(`Created shared Redis connection: ${name}`);
}
return RedisConnectionManager.sharedConnections.get(name)!;
const connection = RedisConnectionManager.sharedConnections.get(name);
if (!connection) {
throw new Error(`Expected connection ${name} to exist in shared connections`);
}
return connection;
} else {
// Create unique connection per instance
const uniqueName = `${name}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
@ -113,7 +117,7 @@ export class RedisConnectionManager {
try {
await connection.quit();
} catch (error) {
this.logger.warn('Error closing Redis connection:', error);
this.logger.warn('Error closing Redis connection:', error as Error);
}
}

View file

@ -21,7 +21,11 @@ export function createCache(options: CacheOptions): CacheProvider {
const cacheKey = `${defaultOptions.keyPrefix}-${defaultOptions.ttl}`;
if (cacheInstances.has(cacheKey)) {
return cacheInstances.get(cacheKey)!;
const cachedInstance = cacheInstances.get(cacheKey);
if (!cachedInstance) {
throw new Error(`Expected cache instance ${cacheKey} to exist`);
}
return cachedInstance;
}
const cache = new RedisCache(defaultOptions);