bugfix: 文件总字节大小丢失问题

dev2.0
陈伟 2025-04-29 15:21:07 +08:00
parent 238a7172b4
commit 0ed51baf20
3 changed files with 4 additions and 5 deletions

View File

@ -45,7 +45,7 @@ public class MinioDownloadTask : NotifyPropertyChangedBase
[SugarColumn(ColumnName = "file_path")]
public string FilePath { get; set; }
[SugarColumn(ColumnName = "status")] public string Status { get; set; } = "等待中";
[SugarColumn(ColumnName = "status")] public string Status { get; set; }
[SugarColumn(ColumnName = "create_time")]
public string CreateTime { get; set; }

View File

@ -467,7 +467,9 @@ namespace Hopetry.Services
var temp = new MinioDownloadTask
{
TaskId = downTask.TaskId,
Downloaded = bytesRead + offset
Downloaded = bytesRead + offset,
TotalSize = totalBytes, // 不可为null ,每次都有默认值
Status = "下载中"
};
// todo 这里有bug,有可能变成0
downTask.Downloaded = temp.Downloaded;

View File

@ -460,7 +460,6 @@ public class DownViewModel : MvcViewModelBase
{
temp.Add(task);
}
_taskQueue.Clear(); // 清空任务队列
foreach (var item in runTask)
{
@ -471,12 +470,10 @@ public class DownViewModel : MvcViewModelBase
// 重新加入下载队列
temp.Add(item);
}
while (num-- > 0)
{
_semaphore.Wait();
}
foreach (var item in temp)
{
_taskQueue.Enqueue(item);