-
Notifications
You must be signed in to change notification settings - Fork 516
修复 sdk 最近的一些 issue #400
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
修复 sdk 最近的一些 issue #400
Conversation
在 PR 描述里写 fix #xxx( |
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.
完美
src/upload.js
Outdated
@@ -273,8 +276,15 @@ export class UploadManager { | |||
} | |||
|
|||
finishDirectProgress(){ |
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.
空格 哈哈哈
@@ -273,8 +276,15 @@ export class UploadManager { | |||
} | |||
|
|||
finishDirectProgress(){ | |||
// 在某些浏览器环境下,xhr 的 progress 事件无法被触发,progress 为 null, 这里 fake 下 | |||
if (!this.progress) { |
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.
整体流程上看 progress 为 null 的情况确认只需要处理这一处吗?
记得之前出 bug 好像有不止一个地方会因为 progress 出 null 的问题的…
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.
有两处啊,毕竟上传方式有两种
@@ -231,12 +230,16 @@ export class UploadManager { | |||
onProgress, | |||
onCreate | |||
}).then(response => { | |||
// 在某些浏览器环境下,xhr 的 progress 事件无法被触发,progress 为 null,这里在每次分片上传完成后都手动更新下 progress | |||
onProgress({ loaded: chunk.size }); |
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.
确认一下 progress 多触发一两次没问题吗?
另外触发顺序检查了吗?(确保 progress 一定是增的或者说不减的,并且一定在 complete 前触发)
"es3ify-loader": "^0.2.0", | ||
"open-browser-webpack-plugin": "0.0.5", | ||
"qiniu-js": "^2.5.4", |
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.
只需要更新一个 demo 的依赖?
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.
是的,只有这个是单独有自己的node_modules
src/statisticsLog.js
Outdated
xhr.open("POST", "https://uplog.qbox.me/log/3"); | ||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | ||
xhr.setRequestHeader("Authorization", "UpToken " + token); | ||
xhr.onreadystatechange = function () { | ||
if (xhr.readyState === 4) { | ||
if (xhr.status !== 200) { | ||
count++; | ||
count <= 3 ? xhr.send(logString) : ""; | ||
} | ||
count <= 3 ? self.send(logString, token) : ""; |
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.
3 这个 magic number 哪来的?
是配置项里的 retryCount 吗?
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.
不是, 这里它自己的重试,不过这里的确有点问题
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.
👌
fix #411 fix #372 fix #386 fix #362
这次更改主要解决以下问题: