mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-05-06 23:31:59 +08:00
refactor: improve upload handling (#1455)
* fix(quark): refactor upPart to use http.NewRequest * fix(quark): improved upload handling * fix(quark_open): improved upload handling * fix: add retry context to multiple upload functions * fix: optimize hash calculation in multipart upload to avoid blocking * fix: update error handling in lifecycle functions for better clarity * fix: update upload progress calculation to improve accuracy * fix: simplify error handling in lifecycle functions for improved readability * fix: remove unnecessary mutex for part uploads to simplify code * fix(stream): simplify file handling in NewStreamSectionReader and improve error messages * fix(terabox): optimize chunk count calculation in Put method * perf(chaoxing): 表单上传文件0拷贝 * fix(cnb_releases): improve file upload progress tracking * fix(baidu_netdisk): improve upload handling * fix(upload): optimize buffer initialization for file uploads * fix(baidu_netdisk): add retry condition to skip ErrUploadIDExpired in upload loop
This commit is contained in:
@@ -29,6 +29,7 @@ func NewGroupWithContext(ctx context.Context, limit int, retryOpts ...retry.Opti
|
||||
}
|
||||
|
||||
// OrderedGroup
|
||||
// 使得Lifecycle.Before是有序且线程安全
|
||||
func NewOrderedGroupWithContext(ctx context.Context, limit int, retryOpts ...retry.Option) (*Group, context.Context) {
|
||||
group, ctx := NewGroupWithContext(ctx, limit, retryOpts...)
|
||||
group.startChan = make(chan token, 1)
|
||||
@@ -53,11 +54,11 @@ func (g *Group) Go(do func(ctx context.Context) error) {
|
||||
}
|
||||
|
||||
type Lifecycle struct {
|
||||
// Before在OrderedGroup是线程安全的。
|
||||
// Before在OrderedGroup是有序且线程安全的
|
||||
// 只会被调用一次
|
||||
Before func(ctx context.Context) error
|
||||
Before func(ctx context.Context) (err error)
|
||||
// 如果Before返回err就不调用Do
|
||||
Do func(ctx context.Context) error
|
||||
Do func(ctx context.Context) (err error)
|
||||
// 最后调用一次After
|
||||
After func(err error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user