fix(core): Stop explicit redis client disconnect on shutdown (#10551)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-08-26 15:15:04 +02:00 committed by GitHub
parent fcc46b693f
commit f71281221e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,12 +2,10 @@ import { Service } from 'typedi';
import { Logger } from '@/logger';
import ioRedis 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 type { RedisClientType } from './redis.types';
@Service()
export class RedisClientService {
private readonly clients = new Set<ioRedis | Cluster>();
@ -28,13 +26,6 @@ export class RedisClientService {
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.
* See: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md