修复sse监听器没有清理的问题

This commit is contained in:
2025-10-04 18:33:18 +08:00
parent 61159a88ef
commit 6b9b38a80c
3 changed files with 160 additions and 27 deletions
+8 -1
View File
@@ -45,6 +45,9 @@ class DownloadService {
// 先创建下载执行器,稍后在init方法中设置downloadService引用
this.downloadExecutor = new DownloadExecutor(this.fileManager, this.taskManager, this.progressManager, this.historyManager, this);
// 启动监听器定期清理检查
this.progressManager.startPeriodicCleanup();
this.initialized = false;
}
@@ -92,7 +95,11 @@ class DownloadService {
// 代理方法 - 进度管理
addProgressListener(taskId, listener) {
return this.progressManager.addProgressListener(taskId, listener);
const result = this.progressManager.addProgressListener(taskId, listener);
if (!result) {
logger.warn(`添加进度监听器失败: ${taskId}`);
}
return result;
}
removeProgressListener(taskId, listener) {