Skip to content

The only downloader you need. 下载器的集大成者。

fix: 修复任务恢复时速度不正确

AlphaQian63a7831351f4
diff --git a/app/common/download_task.py b/app/common/download_task.py
index a4a1beb5..e0b6f12a 100644
--- a/app/common/download_task.py
+++ b/app/common/download_task.py
@@ -223,7 +223,7 @@ class DownloadTask(QThread):
self.downloadStrategy = None
# Speed tracking
- self.historyProgress = deque([self.progress] * 10) # Rolling window of 10 seconds for speed calculation
+ self.historyProgress = deque(maxlen = 10) # Rolling window of 10 seconds for speed calculation
# HTTP client setup
proxy = getProxy()
@@ -720,6 +720,12 @@ class DownloadTask(QThread):
# Load or create workers
self.__loadWorkers()
+ # Calculate total progress
+ self.progress = 0
+ for worker in self.workers:
+ self.progress += worker.progress - worker.startPos
+ self.historyProgress = deque([self.progress] * 10, maxlen = 10)
+
# Create and configure event loop
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())