Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnecting triggered with the latest release @4.6.2 #2395

Closed
faljabi opened this issue Jan 28, 2023 · 2 comments · Fixed by #2396
Closed

Reconnecting triggered with the latest release @4.6.2 #2395

faljabi opened this issue Jan 28, 2023 · 2 comments · Fixed by #2396
Labels

Comments

@faljabi
Copy link

faljabi commented Jan 28, 2023

Description

I just upgraded redis ^4.5.1 → ^4.6.2 and I get extra reconnecting event.

const redis = require('redis');
const config = require('config');
const { loggers: { consoleLogger, errorLogger } } = require('../logging');

const client = redis.createClient({
    url: config.get('redis.url'),
    disableOfflineQueue: true,
    legacyMode: true
});

client.on('ready', _ => consoleLogger.info('🔥 redis ready'));
client.on('reconnecting', _ => consoleLogger.info('📞 redis reconnecting'));
client.on('end', _ => consoleLogger.warn('🔌 redis disconnected'));
client.on('error', error => {

    errorLogger.error('❌ redis error', { err: error });
});

client.connect();

module.exports = client;

The below is printed. I did not get this on the earlier versiob v4.5.1
[01:55:11 AM] INFO 🔥 redis ready
[01:55:11 AM] INFO 📞 redis reconnecting

Node.js Version

v19.4

Redis Server Version

No response

Node Redis Version

No response

Platform

macOS

Logs

No response

@faljabi faljabi added the Bug label Jan 28, 2023
leibale added a commit to leibale/node-redis that referenced this issue Jan 28, 2023
@leibale
Copy link
Collaborator

leibale commented Jan 28, 2023

Tnx for reporting! It's not actually reconnecting, I accidentally moved the emit outside the catch block, so it's emitting reconnecting even when there is no error (see the fix here). Releasing a new version now...

leibale added a commit that referenced this issue Jan 28, 2023
* fix #2395 - fix reconnecting event

* Update socket.ts
@leibale
Copy link
Collaborator

leibale commented Jan 28, 2023

redis@4.6.3/@redis/client@1.5.4 is on npm 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants