mirror of https://github.com/Mai-with-u/MaiBot.git
commit
ccfd6cc02d
|
|
@ -519,6 +519,7 @@ class StatisticOutputTask(AsyncTask):
|
||||||
|
|
||||||
last_all_time_stat = None
|
last_all_time_stat = None
|
||||||
|
|
||||||
|
try:
|
||||||
if "last_full_statistics" in local_storage:
|
if "last_full_statistics" in local_storage:
|
||||||
# 如果存在上次完整统计数据,则使用该数据进行增量统计
|
# 如果存在上次完整统计数据,则使用该数据进行增量统计
|
||||||
last_stat: Dict[str, Any] = local_storage["last_full_statistics"] # 上次完整统计数据 # type: ignore
|
last_stat: Dict[str, Any] = local_storage["last_full_statistics"] # 上次完整统计数据 # type: ignore
|
||||||
|
|
@ -542,6 +543,8 @@ class StatisticOutputTask(AsyncTask):
|
||||||
last_stat_timestamp = datetime.fromtimestamp(last_stat["timestamp"]) # 上次完整统计数据的时间戳
|
last_stat_timestamp = datetime.fromtimestamp(last_stat["timestamp"]) # 上次完整统计数据的时间戳
|
||||||
self.stat_period = [item for item in self.stat_period if item[0] != "all_time"] # 删除"所有时间"的统计时段
|
self.stat_period = [item for item in self.stat_period if item[0] != "all_time"] # 删除"所有时间"的统计时段
|
||||||
self.stat_period.append(("all_time", now - last_stat_timestamp, "自部署以来的"))
|
self.stat_period.append(("all_time", now - last_stat_timestamp, "自部署以来的"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"加载上次完整统计数据失败,进行全量统计,错误信息:{e}")
|
||||||
|
|
||||||
stat_start_timestamp = [(period[0], now - period[1]) for period in self.stat_period]
|
stat_start_timestamp = [(period[0], now - period[1]) for period in self.stat_period]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue