-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Perf upload and cache #4965
Conversation
@@ -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的文件 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对的,大小为0的文件无法上传成功
drivers/aliyundrive_open/types.go
Outdated
} | ||
|
||
func fileToObj(f File) *model.ObjThumb { | ||
return &model.ObjThumb{ | ||
Object: model.Object{ | ||
ID: f.FileId, | ||
Name: f.Name, | ||
Name: f.Name + f.FileName, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
逻辑上是没有问题的,Name和FileName只会返回一个
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
虽然我认为这些非耗时操作没有必要使用context,但如果有需要也可以加上
暂时就改这些了,其他的不是没号就是空间有限不好测试了。 |
不得不说crypt真好用,为此优化几个常用的存储驱动
特别是百度和阿里的api真脆弱,时不时就报错