Skip to content

Commit 3a073e8

Browse files
author
zhangheng
committed
fix review
1 parent 27c80bc commit 3a073e8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/statisticsLog.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@ export class StatisticsLogger{
55
log(info, token) {
66
let logString = "";
77
Object.keys(info).forEach(k => logString += info[k] + ",");
8-
this.send(logString, token);
8+
this.send(logString, token, 0);
99
}
1010

11-
send(logString, token){
11+
send(logString, token, retryCount){
1212
let xhr = createXHR();
13-
let count = 0;
1413
let self = this;
1514
xhr.open("POST", "https://uplog.qbox.me/log/3");
1615
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1716
xhr.setRequestHeader("Authorization", "UpToken " + token);
1817
xhr.onreadystatechange = function () {
1918
if (xhr.readyState === 4) {
2019
if (xhr.status !== 200) {
21-
count++;
22-
count <= 3 ? self.send(logString, token) : "";
20+
retryCount++;
21+
retryCount <= 3 ? self.send(logString, token, retryCount) : "";
2322
}
2423
}
2524
};

src/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export class UploadManager {
275275
this.onData(this.progress);
276276
}
277277

278-
finishDirectProgress(){
278+
finishDirectProgress() {
279279
// 在某些浏览器环境下,xhr 的 progress 事件无法被触发,progress 为 null, 这里 fake 下
280280
if (!this.progress) {
281281
this.progress = { total: this.getProgressInfoItem(this.file.size, this.file.size) };

0 commit comments

Comments
 (0)