fix(core): Disconnect Redis after pausing queue during worker shutdown (#9928)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Iván Ovejero
2024-07-04 18:07:47 +02:00
committed by GitHub
parent e5c324753f
commit c82579bf76
6 changed files with 15 additions and 15 deletions

View File

@@ -4,7 +4,7 @@ import { Logger } from '@/Logger';
import ioRedis from 'ioredis';
import type { Cluster, RedisOptions } from 'ioredis';
import type { RedisClientType } from './RedisServiceBaseClasses';
import { OnShutdown } from '@/decorators/OnShutdown';
import { LOWEST_PRIORITY, OnShutdown } from '@/decorators/OnShutdown';
@Service()
export class RedisClientService {
@@ -23,7 +23,7 @@ export class RedisClientService {
return client;
}
@OnShutdown()
@OnShutdown(LOWEST_PRIORITY)
disconnectClients() {
for (const client of this.clients) {
client.disconnect();
@@ -144,6 +144,8 @@ export class RedisClientService {
}
}
this.logger.warn('Redis unavailable - trying to reconnect...');
return RETRY_INTERVAL;
};
}