implement stopCheck

This commit is contained in:
Iuri Matias 2017-03-11 11:23:42 -05:00
parent 2dec088a9b
commit 5cf287a747
1 changed files with 7 additions and 1 deletions

View File

@ -10,10 +10,16 @@ var ServicesMonitor = function(options) {
ServicesMonitor.prototype.addCheck = function(name, checkFn, time) {
this.logger.info('add check: ' + name);
// TODO: check if a service with the same name already exists
this.checkList[name] = {fn: checkFn, interval: time || 5000};
};
ServicesMonitor.prototype.stopCheck = function(name) {
clearInterval(this.checkTimers[name]);
delete this.checkTimers[name];
delete this.checkList[name];
delete this.checkState[name];
};
ServicesMonitor.prototype.startMonitor = function() {
this.logger.info('startMonitor');
var self = this;