Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
fix bug in redis client disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyang committed Jun 14, 2017
1 parent 1eb91c8 commit 1b60e66
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/monitors/redismonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Monitor.prototype.start = function(cb) {
Monitor.prototype.stop = function() {
this.client.disconnect();
if (!!this.pingRedis) {
this.pingRedis.disconnect();
this.pingRedis.end();
}
clearInterval(this.timer);
};
Expand Down Expand Up @@ -183,14 +183,14 @@ var getMaster = function(self, redisNodes) {
ping(self, client, redis);
}, constants.TIME.DEFAULT_REDIS_PING);
} else {
client.disconnect();
client.end();
client = null;
}
});
});
client.on('error', function() {
logger.error('[redisMonitor] monitor redis connect error');
client.disconnect();
client.end();
client = null;
});
})(i);
Expand All @@ -203,7 +203,7 @@ var ping = function(self, client, rds) {
clearInterval(self.pingtimer);
if(self.pingtimer) {
logger.info('[redisMonitor] clear pingtimer timeout');
client.disconnect();
client.end();
client = null;
self.pingtimer = null;
rds.disconnect();
Expand All @@ -225,7 +225,7 @@ var clearPingTimer = function(self, cb) {
clearInterval(self.pingtimer);
var client = self.pingRedis;
if(!!client) {
client.disconnect();
client.end();
client = null;
self.pingtimer = null;
}
Expand Down

0 comments on commit 1b60e66

Please sign in to comment.