refactor(upload): 优化文件上传服务的异步处理和调试输出

- 将同步Thread.Sleep替换为异步Task.Delay以提高性能
- 移除调试用的控制台输出语句
- 统一移除验证和进度相关的打印日志
dev2.0
一梦千年 2026-01-26 15:15:49 +08:00
parent 0718a29850
commit e68391d54a
3 changed files with 4 additions and 4 deletions

View File

@ -1014,7 +1014,7 @@ namespace Hopetry.Provider
.WithBucket(bucketName)
.WithObject(objectName));
Console.WriteLine($"验证成功!文件大小: {stat.Size} 字节, ETag: {stat.ETag}");
//Console.WriteLine($"验证成功!文件大小: {stat.Size} 字节, ETag: {stat.ETag}");
return;
}
catch (Exception ex)

View File

@ -95,7 +95,7 @@ namespace Hopetry.Services
.Where(r => r.Id == id)
.ExecuteCommand();
Console.WriteLine($"数据库更新结果: {result}, ID: {id}, Flag: {flag}");
//Console.WriteLine($"数据库更新结果: {result}, ID: {id}, Flag: {flag}");
return result > 0;
}

View File

@ -631,7 +631,7 @@ namespace HeBianGu.App.Disk
var pendingItems = UpLoadItems.Where(r => !r.Bool1).ToList();
if (!pendingItems.Any())
Thread.Sleep(500);
await Task.Delay(500); // 使用异步延时替代同步休眠
// 分批处理,避免一次性启动过多任务
const int batchSize = 10;
@ -835,7 +835,7 @@ namespace HeBianGu.App.Disk
? Math.Round((decimal)(CompleteItems.Count * 100/ (UpLoadItems.Count + CompleteItems.Count)) ,
2)
: 0;
Console.WriteLine($"当前上传进度:{Progress}%");
//Console.WriteLine($"当前上传进度:{Progress}%");
// 更新网盘空间页面状态
/*if (_explorerBehavior != null)
{