|
|
@ -70,7 +70,6 @@ class Monitor { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { |
|
|
|
let configs = await _self.getConfig(); |
|
|
|
let configs = await _self.getConfig(); |
|
|
|
if (configs.monit_urls.length == 0) { |
|
|
|
if (configs.monit_urls.length == 0) { |
|
|
|
console.error("No monit urls in the config file."); |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -104,7 +103,7 @@ class Monitor { |
|
|
|
task = _self.tasks[index]; |
|
|
|
task = _self.tasks[index]; |
|
|
|
if (task.status == 'done') {continue;} |
|
|
|
if (task.status == 'done') {continue;} |
|
|
|
|
|
|
|
|
|
|
|
console.log('Query task result of %s', task.id); |
|
|
|
//console.log('Query task result of %s', task.id);
|
|
|
|
taskRes = await common.queryHeroUnionTask(task.id, configs); |
|
|
|
taskRes = await common.queryHeroUnionTask(task.id, configs); |
|
|
|
if (taskRes && taskRes.code == 1) { |
|
|
|
if (taskRes && taskRes.code == 1) { |
|
|
|
_self.tasks[index] = taskRes.task; |
|
|
|
_self.tasks[index] = taskRes.task; |
|
|
@ -138,7 +137,6 @@ class Monitor { |
|
|
|
&& this.config.resultQueryFrequence ? this.config.resultQueryFrequence : 5; //5 分钟检测一次
|
|
|
|
&& this.config.resultQueryFrequence ? this.config.resultQueryFrequence : 5; //5 分钟检测一次
|
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, async () => { |
|
|
|
if (_self.tasks.length == 0) { |
|
|
|
if (_self.tasks.length == 0) { |
|
|
|
console.error("No tasks to check result."); |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|