set max listeners

This commit is contained in:
m5r 2022-07-02 19:42:11 +02:00
parent 110c8a0948
commit a289115207

View File

@ -21,9 +21,11 @@ const redisOptions: RedisOptions = {
// create a new connection to the Redis with every change either. // create a new connection to the Redis with every change either.
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
redis = new Redis(serverConfig.redis.url, redisOptions); redis = new Redis(serverConfig.redis.url, redisOptions);
redis.setMaxListeners(32);
} else { } else {
if (!global.__redis) { if (!global.__redis) {
global.__redis = new Redis(serverConfig.redis.url, redisOptions); global.__redis = new Redis(serverConfig.redis.url, redisOptions);
global.__redis.setMaxListeners(32);
} }
redis = global.__redis; redis = global.__redis;
} }