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