fixed more lint issues
This commit is contained in:
parent
48503ce8d1
commit
cc014de397
11 changed files with 42 additions and 11 deletions
8
libs/cache/src/connection-manager.ts
vendored
8
libs/cache/src/connection-manager.ts
vendored
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
6
libs/cache/src/index.ts
vendored
6
libs/cache/src/index.ts
vendored
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue