- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.9k
Open
Labels
Description
Description
import { createClient } from 'redis'
// ...
        this.redisClient = createClient({
            url: 'redis://localhost:6379',
            disableOfflineQueue: true,
            socket: {
                connectTimeout: 1000,
            },
        })
            .on('error', () => {
                console.log('🙉 REDIS ERROR')
            })
            .on('connect', () => {
                console.log('🙃 REDIS CONNECT')
            })
            .on('ready', () => {
                console.log('😎 REDIS READY')
            })
            .on('end', () => {
                console.log('👋 REDIS END')
            })
            .on('close', () => {
                console.log('👊 REDIS CLOSE')
            })
            .on('reconnecting', () => {
                console.log('🫠  REDIS RECONNECTING')
            })
            .on('reconnect', () => {
                console.log('🤗 REDIS RECONNECT')
            })
            .on('invalidate', () => {
                console.log('🫡 REDIS INVALIDATE')
            })Steps to reproduce:
- Start Redis
- Run code listed above
- Terminal output:
🙃 REDIS CONNECT
😎 REDIS READY
- Stop Redis
- Terminal output:
🙉 REDIS ERROR
🫠  REDIS RECONNECTING
🙃 REDIS CONNECT
🙉 REDIS ERROR
😎 REDIS READY
Notice last REDIS READY.
Next, once Redis server restarted it could not reconnect.
The bug was introduced starting 5.0.0. Works okay on 4.7.0
Node.js Version
24.7.0
Redis Server Version
7.4.6
Node Redis Version
5.9.0
Platform
macOS
Logs
gustavopaes and avoylenko