From 1ed86bc32e0afa258cd266f77fc756b45c3fd90c Mon Sep 17 00:00:00 2001 From: filesite Date: Sun, 7 Apr 2024 20:29:01 +0800 Subject: [PATCH] function stats ready --- heroUnion.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/heroUnion.mjs b/heroUnion.mjs index d9e1ddc..ea8c315 100644 --- a/heroUnion.mjs +++ b/heroUnion.mjs @@ -35,7 +35,9 @@ class HeroUnion { this.task_data_max_size = 1024; //任务数据最大字节数,单位:KB this.notify_timeout = 8; //回调通知请求超时时长,单位:秒 - this.stats = {}; + this.stats = { + start_time: common.getTimestampInSeconds() + }; this.heros = []; //hero爬虫队列 this.tasks = []; //任务队列 @@ -329,6 +331,10 @@ class HeroUnion { //获取联盟状态 stats() { + this.stats.taskStatus = this.taskStatus; + this.stats.heroStatus = this.heroStatus; + this.stats.run_seconds = common.getTimestampInSeconds() - this.stats.start_time; + return this.stats; }