fixed format issues
This commit is contained in:
parent
a700818a06
commit
08f713d98b
55 changed files with 5680 additions and 5533 deletions
14
libs/core/cache/src/connection-manager.ts
vendored
14
libs/core/cache/src/connection-manager.ts
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import Redis from 'ioredis';
|
||||
import type { RedisConfig } from './types';
|
||||
import { REDIS_DEFAULTS } from './constants';
|
||||
import type { RedisConfig } from './types';
|
||||
|
||||
interface ConnectionConfig {
|
||||
name: string;
|
||||
|
|
@ -29,7 +29,7 @@ export class RedisConnectionManager {
|
|||
*/
|
||||
getConnection(config: ConnectionConfig): Redis {
|
||||
const { name, singleton = true, redisConfig } = config;
|
||||
|
||||
|
||||
if (singleton) {
|
||||
const existing = RedisConnectionManager.connections.get(name);
|
||||
if (existing) {
|
||||
|
|
@ -38,11 +38,11 @@ export class RedisConnectionManager {
|
|||
}
|
||||
|
||||
const connection = this.createConnection(redisConfig);
|
||||
|
||||
|
||||
if (singleton) {
|
||||
RedisConnectionManager.connections.set(name, connection);
|
||||
}
|
||||
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
|
@ -68,10 +68,8 @@ export class RedisConnectionManager {
|
|||
* Close all connections
|
||||
*/
|
||||
static async closeAll(): Promise<void> {
|
||||
const promises = Array.from(this.connections.values()).map(conn =>
|
||||
conn.quit().catch(() => {})
|
||||
);
|
||||
const promises = Array.from(this.connections.values()).map(conn => conn.quit().catch(() => {}));
|
||||
await Promise.all(promises);
|
||||
this.connections.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue