refactor(uploader): 优化文件上传处理逻辑和资源管理
构建上传工具 / build-tool (push) Successful in 1m20s

- 简化响应体关闭逻辑,移除不必要的nil检查
- 调整后台状态推送频率,从500ms改为250ms
- 修复前端事件监听器注册顺序
- 移除未使用的进度变量
- 优化goroutine中的任务执行逻辑
- 改进文件路径显示,统一使用文件名而非完整路径
- 添加waitgroup等待确保资源正确释放
This commit is contained in:
2026-04-28 01:07:43 +08:00
parent 12ef425b01
commit 75de353af6
4 changed files with 41 additions and 40 deletions
+3 -4
View File
@@ -38,9 +38,8 @@ func UploadDataToServer(ctx context.Context, data string) error {
if err != nil {
return err
}
if resp != nil {
_, _ = io.Copy(io.Discard, resp.Body)
resp.Body.Close()
}
io.Copy(io.Discard, resp.Body)
resp.Body.Close()
return err
}