Skip to content

Commit b989d36

Browse files
authored
4.x 优化针对进度回退的处理 (#681)
* 适当降低虚拟进度条的输出速度 * 细节优化
1 parent 12efc5e commit b989d36

File tree

7 files changed

+8
-11
lines changed

7 files changed

+8
-11
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/browser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qiniu-js",
3-
"version": "4.0.0-beta.5",
3+
"version": "4.0.0-beta.6",
44
"description": "Qiniu browser upload sdk",
55
"miniprogram": "output",
66
"main": "output/index.js",

packages/common/src/helper/progress/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class MockProgress {
3434

3535
let time = 0
3636
this.progress = 0
37-
const intervalFrequency = 100
37+
const intervalFrequency = 400
3838
const intervalIds = setInterval(() => {
3939
time += intervalFrequency
4040
this.setProgress(1 - Math.exp(-1 * time / (this.timeConstant * 1000)))

packages/common/src/upload/common/context/index.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ export function updateTotalIntoProgress(progress: Progress): Progress {
3333
}
3434

3535
const newPercent = totalPercent / detailValues.length
36-
37-
// 在失败重试等场景中,进度回退是正常业务导致的,但是客户要求进度不能回退
38-
if (newPercent > progress.percent) progress.percent = newPercent // 防止进度倒流
39-
36+
progress.percent = newPercent
4037
progress.size = totalSize
4138
return progress
4239
}

packages/common/src/upload/multipartv1/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export const createMultipartUploadV1Task = (file: UploadFile, config: UploadConf
202202
prefix: 'MultipartUploadChildQueue'
203203
},
204204
concurrentLimit: 1, // 此接口只能串行
205-
// TODO 动态创建任务会导致任务进度倒退
205+
// FIXME 动态创建任务会导致任务进度倒退
206206
tasksCreator: async () => {
207207
const sliceResult = await file.slice(4 * 1024 * 1024)
208208
if (isErrorResult(sliceResult)) {

packages/common/src/upload/multipartv2/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export const createMultipartUploadV2Task = (file: UploadFile, config: UploadConf
318318
},
319319
concurrentLimit: 3,
320320

321-
// TODO 动态创建任务会导致任务进度倒退
321+
// FIXME: 动态创建任务会导致任务进度倒退
322322
tasksCreator: async () => {
323323
const sliceResult = await file.slice(4 * 1024 * 1024)
324324
if (isErrorResult(sliceResult)) {

packages/wechat-miniprogram/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qiniu/wechat-miniprogram-upload",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Qiniu wechat-miniprogram upload sdk",
55
"miniprogram": "output",
66
"main": "output/index.js",

0 commit comments

Comments
 (0)