-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Monitor listener not present after reconnect #52
Comments
Thank you for reporting this. It's a bug that monitors don't work after reconnection and will be fixed in the next release. However I just did some tests but haven't found any way to reproduce the var redis = new Redis(6999);
var listener = function (time, args) {
console.log(time, args);
};
redis.monitor(function (err, monitor) {
monitor.on('monitor', listener);
redis.on('ready', function () {
monitor.removeListener('monitor', listener);
monitor.on('monitor', listener);
});
}); |
Thanks for the reply. I'll add code as soon as I can but I'll be away from this server for about a week on a work trip. I'll update you when I get back to it. Thanks! |
Hey thanks for fixing this! I'll be sure to update. For your curiosity this was the code that was giving me the
This was basically my fix for checking the ready state and if it was monitored. I tried both removeAllListeners and .off() Thanks again for the quick fix! |
Just confirmed monitors are working as expected. Thanks again. |
I have my Redis master setup on a private DNS name with a TTL of 30. Average reconnection it obviously around that time once everything propagates.
One thing I've noticed is that any
monitor
that is running on the client is not present after a reconnect.To see if I could recreate it on a reconnect I first called
monitor.off('monitor');
and then attached the listener again onceredis.status
wasready
.It's not an important part of my server so I wasn't worried about it not working, but one thing that happened was this lovely error:
So I'm reporting it just like you asked. Looks to be a
hiredis
issue and not yours perhaps.If you need more info let me know!
The text was updated successfully, but these errors were encountered: