当所有任务处于跳过状态时,update_download_status 不被调用, 导致 _total_download_speed 保留上一次的旧值一直显示。 通过检查 _last_download_time,超过 2 秒无新数据则返回 0。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,9 @@ def get_download_result() -> dict:
|
|||||||
|
|
||||||
def get_total_download_speed() -> int:
|
def get_total_download_speed() -> int:
|
||||||
"""get total download speed"""
|
"""get total download speed"""
|
||||||
|
# 超过 2 秒没有新数据,视为速度为 0(防止旧速度值残留显示)
|
||||||
|
if time.time() - _last_download_time > 2.0:
|
||||||
|
return 0
|
||||||
return _total_download_speed
|
return _total_download_speed
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user