Files
redlight/server/config/redis.js
Michelle 5cb8201fb5
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m5s
Update Redis configuration to allow unlimited retries and disable offline queue
2026-02-28 14:17:01 +01:00

25 lines
618 B
JavaScript

import Redis from 'ioredis';
const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379';
const redis = new Redis(REDIS_URL, {
maxRetriesPerRequest: null,
retryStrategy: (times) => {
if (times > 3) return null; // stop retrying after 3 attempts
return Math.min(times * 200, 1000);
},
});
redis.on('error', (err) => {
// Suppress ECONNREFUSED noise after initial failure — only warn
if (err.code !== 'ECONNREFUSED') {
console.warn('⚠️ DragonflyDB error:', err.message);
}
});
redis.on('connect', () => {
console.log('🐉 DragonflyDB connected');
});
export default redis;