Browse Source

change cronjobs frequence

master
filesite 8 months ago
parent
commit
b40dff4044
  1. 8
      conf/config.json
  2. 16
      heroUnion.mjs

8
conf/config.json

@ -9,10 +9,10 @@ @@ -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,

16
heroUnion.mjs

@ -399,8 +399,8 @@ class HeroUnion { @@ -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 { @@ -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 { @@ -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 { @@ -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);

Loading…
Cancel
Save