Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf upload and cache #4965

Merged
merged 16 commits into from
Aug 9, 2023
Merged

Perf upload and cache #4965

merged 16 commits into from
Aug 9, 2023

Conversation

foxxorcat
Copy link
Member

不得不说crypt真好用,为此优化几个常用的存储驱动
特别是百度和阿里的api真脆弱,时不时就报错

@@ -211,6 +221,11 @@ func (d *BaiduPhoto) Remove(ctx context.Context, obj model.Obj) error {
}

func (d *BaiduPhoto) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) (model.Obj, error) {
// 不支持大小为0的文件
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this limitation of baidu_photo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对的,大小为0的文件无法上传成功

}

func fileToObj(f File) *model.ObjThumb {
return &model.ObjThumb{
Object: model.Object{
ID: f.FileId,
Name: f.Name,
Name: f.Name + f.FileName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? if yes, can we at least add some logic of handling both of them not being empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑上是没有问题的,Name和FileName只会返回一个

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑上是没有问题的,Name和FileName只会返回一个

建议使用 两者不为空的一个且仅一个

preTime = time.Now()
}
}
func (d *AliyundriveOpen) completeUpload(fileId, uploadId string) (model.Obj, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also handle the context here? just in case it's canceled

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

虽然我认为这些非耗时操作没有必要使用context,但如果有需要也可以加上

@xhofe xhofe added this to the v3.26.0 milestone Aug 9, 2023
@foxxorcat
Copy link
Member Author

暂时就改这些了,其他的不是没号就是空间有限不好测试了。

@xhofe xhofe merged commit df6b306 into alist-org:main Aug 9, 2023
2 checks passed
@foxxorcat foxxorcat deleted the perf_upload_and_cache branch August 10, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants