|
|
@ -399,8 +399,8 @@ class HeroUnion { |
|
|
|
let _self = this; |
|
|
|
let _self = this; |
|
|
|
|
|
|
|
|
|
|
|
const frequence = typeof(this.config.heroHeartCheckFrequence) != 'undefined' |
|
|
|
const frequence = typeof(this.config.heroHeartCheckFrequence) != 'undefined' |
|
|
|
&& this.config.heroHeartCheckFrequence ? this.config.heroHeartCheckFrequence : 60; //1 分钟检查一次
|
|
|
|
&& this.config.heroHeartCheckFrequence ? this.config.heroHeartCheckFrequence : 1; //1 分钟检查一次
|
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * * *`, () => { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, () => { |
|
|
|
let timestamp = common.getTimestampInSeconds(); |
|
|
|
let timestamp = common.getTimestampInSeconds(); |
|
|
|
_self.heros.forEach(function(item, index) { |
|
|
|
_self.heros.forEach(function(item, index) { |
|
|
|
if (item.status != 'offline' && timestamp - item.timestamp > _self.heroHeartTimeout) { |
|
|
|
if (item.status != 'offline' && timestamp - item.timestamp > _self.heroHeartTimeout) { |
|
|
@ -424,8 +424,8 @@ class HeroUnion { |
|
|
|
let _self = this; |
|
|
|
let _self = this; |
|
|
|
|
|
|
|
|
|
|
|
const frequence = typeof(this.config.reloadConfigFrequence) != 'undefined' |
|
|
|
const frequence = typeof(this.config.reloadConfigFrequence) != 'undefined' |
|
|
|
&& this.config.reloadConfigFrequence ? this.config.reloadConfigFrequence : 300; //5 分钟重新加载一次
|
|
|
|
&& this.config.reloadConfigFrequence ? this.config.reloadConfigFrequence : 5; //5 分钟重新加载一次
|
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * * *`, () => { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, () => { |
|
|
|
const forceReload = true; |
|
|
|
const forceReload = true; |
|
|
|
_self.getConfig(forceReload); |
|
|
|
_self.getConfig(forceReload); |
|
|
|
}, { |
|
|
|
}, { |
|
|
@ -441,8 +441,8 @@ class HeroUnion { |
|
|
|
let _self = this; |
|
|
|
let _self = this; |
|
|
|
|
|
|
|
|
|
|
|
const frequence = typeof(this.config.autoCleanTaskFrequence) != 'undefined' |
|
|
|
const frequence = typeof(this.config.autoCleanTaskFrequence) != 'undefined' |
|
|
|
&& this.config.autoCleanTaskFrequence ? this.config.autoCleanTaskFrequence : 600; //10 分钟检查一次
|
|
|
|
&& this.config.autoCleanTaskFrequence ? this.config.autoCleanTaskFrequence : 10; //10 分钟检查一次
|
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * * *`, () => { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, () => { |
|
|
|
let timestamp = common.getTimestampInSeconds(); |
|
|
|
let timestamp = common.getTimestampInSeconds(); |
|
|
|
|
|
|
|
|
|
|
|
let tasksLeft = _self.tasks.reduce(function(accumulator, item) { |
|
|
|
let tasksLeft = _self.tasks.reduce(function(accumulator, item) { |
|
|
@ -476,8 +476,8 @@ class HeroUnion { |
|
|
|
let _self = this; |
|
|
|
let _self = this; |
|
|
|
|
|
|
|
|
|
|
|
const frequence = typeof(this.config.autoNotifyTaskFrequence) != 'undefined' |
|
|
|
const frequence = typeof(this.config.autoNotifyTaskFrequence) != 'undefined' |
|
|
|
&& this.config.autoNotifyTaskFrequence ? this.config.autoNotifyTaskFrequence : 120; //2 分钟检查一次
|
|
|
|
&& this.config.autoNotifyTaskFrequence ? this.config.autoNotifyTaskFrequence : 2; //2 分钟检查一次
|
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * * *`, () => { |
|
|
|
const cronjob = cron.schedule(`*/${frequence} * * * *`, () => { |
|
|
|
let task = _self.tasks.find((item) => item.status == 'done' && item.notified == false && item.notify_time < _self.notify_max_try); |
|
|
|
let task = _self.tasks.find((item) => item.status == 'done' && item.notified == false && item.notify_time < _self.notify_max_try); |
|
|
|
if (task) { |
|
|
|
if (task) { |
|
|
|
_self.handleTaskDone(task); |
|
|
|
_self.handleTaskDone(task); |
|
|
|