From 49fb1bd55a8e48596a0cd9fc053828d26af08725 Mon Sep 17 00:00:00 2001 From: yuming Date: Sat, 9 May 2026 11:34:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E4=B8=8B=E8=BD=BD=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=97=B6=E9=80=9F=E5=BA=A6=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=BD=92=E9=9B=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当所有任务处于跳过状态时,update_download_status 不被调用, 导致 _total_download_speed 保留上一次的旧值一直显示。 通过检查 _last_download_time,超过 2 秒无新数据则返回 0。 Co-Authored-By: Claude Sonnet 4.6 --- module/download_stat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/download_stat.py b/module/download_stat.py index a48a66e..40384d2 100644 --- a/module/download_stat.py +++ b/module/download_stat.py @@ -59,6 +59,9 @@ def get_download_result() -> dict: def get_total_download_speed() -> int: """get total download speed""" + # 超过 2 秒没有新数据,视为速度为 0(防止旧速度值残留显示) + if time.time() - _last_download_time > 2.0: + return 0 return _total_download_speed