-
Notifications
You must be signed in to change notification settings - Fork 516
优化缓存调用逻辑 #512
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
优化缓存调用逻辑 #512
Conversation
Codecov Report
@@ Coverage Diff @@
## master #512 +/- ##
==========================================
+ Coverage 72.24% 72.46% +0.21%
==========================================
Files 20 20
Lines 1081 1086 +5
Branches 208 207 -1
==========================================
+ Hits 781 787 +6
+ Misses 300 299 -1
Continue to review full report at Codecov.
|
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.
getProgressInfoItem
作为 resume 独有的东西
为什么实现在 base 里?
src/upload/resume.ts
Outdated
if (info) { | ||
info.fromCache = false | ||
} | ||
if (info) { info.fromCache = false } |
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.
为什么越改越差?
不管 lint 是否正常,这是明确不推荐的行为
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.
NIP: |
|
src/upload/resume.ts
Outdated
this.logger.info(`upload part ${index}.`, info) | ||
|
||
const shouldCheckMD5 = this.config.checkByMD5 | ||
const reuseSaved = () => { | ||
info.fromCache = true | ||
this.uploadedList[index] = info |
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.
其实做了这件事之后,fromCache 确实是有可能存进缓存的
只不过在 reuse 前,它不进去,或者进去也变成了 false
但是 reuse 一次之后,就变成了 true
这样不太好
@@ -239,6 +257,13 @@ export default class Resume extends Base { | |||
return utils.createLocalKey(this.file.name, this.key, this.file.size) | |||
} | |||
|
|||
private updateLocalCache() { |
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.
问个问题,如果有 10 个分片,
如果第一次上传,传成功了 5 个分片的时候,然后关了网页
然后再打开页面上传,第 1 个分片上传成功,然后网络请求失败导致其他分片全部失败了
这时候重新上传,是不是 2~5 这几个本来可以复用的分片就废了?
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.
@huangbinjie dart sdk 是怎样的
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.
lgtm
版本号?
7cfbb21
to
7bfdefa
Compare
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.
lgtm+2
No description provided.