Browse Source

status counter improve

master
filesite 6 months ago
parent
commit
b591a77b2b
  1. 30
      heroUnion.mjs

30
heroUnion.mjs

@ -353,16 +353,16 @@ class HeroUnion {
if (taskIndex > -1) { if (taskIndex > -1) {
this.tasks[taskIndex].notified = notified; this.tasks[taskIndex].notified = notified;
this.tasks[taskIndex].notify_time ++; this.tasks[taskIndex].notify_time ++;
}
//更新任务通知状态数据 //更新任务通知状态数据
if (notified) { if (notified) {
this.taskNotifyStatus.total ++; this.taskNotifyStatus.done ++;
this.taskNotifyStatus.done ++; this.taskNotifyStatus.total = this.taskNotifyStatus.done + this.taskNotifyStatus.failed;
}else if (!notified && this.tasks[taskIndex].notify_time == this.notify_max_try) { }else if (!notified && this.tasks[taskIndex].notify_time == this.notify_max_try) {
this.taskNotifyStatus.total ++; this.taskNotifyStatus.failed ++;
this.taskNotifyStatus.failed ++; this.taskNotifyStatus.total = this.taskNotifyStatus.done + this.taskNotifyStatus.failed;
common.error('[FAILED] Finally failed after %s try, notify to %s', this.notify_max_try, notify_url); common.error('[FAILED] Finally failed after %s try, notify to %s', this.notify_max_try, notify_url);
}
} }
return notified; return notified;
@ -471,17 +471,17 @@ class HeroUnion {
) { ) {
if (_self.taskStatus[item.status] >= 1) { if (_self.taskStatus[item.status] >= 1) {
_self.taskStatus[item.status] --; _self.taskStatus[item.status] --;
}
if (_self.taskStatus.total >= 1) { if (_self.taskStatus.total >= 1) {
_self.taskStatus.total --; _self.taskStatus.total --;
}
} }
let notify_status = item.notified ? 'done' : 'failed'; let notify_status = item.notified ? 'done' : 'failed';
if (_self.taskNotifyStatus[notify_status] >= 1) { if (_self.taskNotifyStatus[notify_status] >= 1) {
_self.taskNotifyStatus[notify_status] --; _self.taskNotifyStatus[notify_status] --;
}
if (_self.taskNotifyStatus.total >= 1) { _self.taskNotifyStatus.total = _self.taskNotifyStatus.done + _self.taskNotifyStatus.failed;
_self.taskNotifyStatus.total --;
} }
common.log('Task %s is expired, which is created at %s', item.id, item.created); common.log('Task %s is expired, which is created at %s', item.id, item.created);

Loading…
Cancel
Save