mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 20:00:02 +00:00
fix(core): Stop explicit redis client disconnect on shutdown (#10551)
This commit is contained in:
committed by
GitHub
parent
fcc46b693f
commit
f71281221e
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user