"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.closeRedisClient = exports.redisClient = void 0;
const ioredis_1 = __importDefault(require("ioredis"));
const env_1 = require("../../main/config/env");
exports.redisClient = new ioredis_1.default(env_1.env.REDIS_URL, {
    retryStrategy: (times) => {
        const delay = Math.min(times * 50, 2000);
        return delay;
    },
    maxRetriesPerRequest: 3,
});
exports.redisClient.on('error', (error) => {
    // eslint-disable-next-line no-console
    console.error('Redis client error', error);
});
exports.redisClient.on('connect', () => {
    // eslint-disable-next-line no-console
    console.info('Redis client connected');
});
const closeRedisClient = async () => {
    await exports.redisClient.quit();
};
exports.closeRedisClient = closeRedisClient;
//# sourceMappingURL=redis-client.js.map