fix(core): Stop explicit redis client disconnect on shutdown (#10551)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-08-26 15:15:04 +02:00
committed by GitHub
parent fcc46b693f
commit f71281221e

View File

@@ -2,12 +2,10 @@ import { Service } from 'typedi';
import { Logger } from '@/logger'; import { Logger } from '@/logger';
import ioRedis from 'ioredis'; import ioRedis from 'ioredis';
import type { Cluster, RedisOptions } from 'ioredis'; import type { Cluster, RedisOptions } from 'ioredis';
import type { RedisClientType } from './redis.types';
import { OnShutdown } from '@/decorators/on-shutdown';
import { LOWEST_SHUTDOWN_PRIORITY } from '@/constants';
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import type { RedisClientType } from './redis.types';
@Service() @Service()
export class RedisClientService { export class RedisClientService {
private readonly clients = new Set<ioRedis | Cluster>(); private readonly clients = new Set<ioRedis | Cluster>();
@@ -28,13 +26,6 @@ export class RedisClientService {
return client; return client;
} }
@OnShutdown(LOWEST_SHUTDOWN_PRIORITY)
disconnectClients() {
for (const client of this.clients) {
client.disconnect();
}
}
/** /**
* Ensure prefix is wrapped in curly braces for Redis cluster. * Ensure prefix is wrapped in curly braces for Redis cluster.
* See: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md * See: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md