don't call calback twice #6375

v1.18.x
Baris Usakli 7 years ago
parent bf770636c5
commit 3c4b4f5263

@ -73,7 +73,7 @@ redisModule.connect = function (options, callback) {
callback = callback || function () {};
var redis_socket_or_host = nconf.get('redis:host');
var cxn;
var callbackCalled = false;
options = options || {};
if (nconf.get('redis:password')) {
@ -92,11 +92,17 @@ redisModule.connect = function (options, callback) {
cxn.on('error', function (err) {
winston.error(err.stack);
if (!callbackCalled) {
callbackCalled = true;
callback(err);
}
});
cxn.on('ready', function () {
if (!callbackCalled) {
callbackCalled = true;
callback();
}
});
if (nconf.get('redis:password')) {

Loading…
Cancel
Save