Skip to content

Commit 36f7699

Browse files
committed
feat: update progress handling in DownloadEngineFile and DownloadEngineRemote for improved accuracy
1 parent 80661df commit 36f7699

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/download/download-engine/download-file/download-engine-file.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ export default class DownloadEngineFile extends EventEmitter<DownloadEngineFileE
473473
this.options.comment = pushComment("cloned", this.options.comment);
474474
this._progressStatus.downloadFlags!.push(DownloadFlags.Cloned);
475475
this._progress.part = this.file.parts.length - 1;
476+
this._progress.chunks.fill(ChunkStatus.COMPLETE);
476477
}
477478

478479
public [Symbol.dispose]() {

src/download/download-engine/engine/DownloadEngineRemote.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ export class DownloadEngineRemote extends EventEmitter<BaseDownloadEngineEvents>
3838
}
3939

4040
public emitRemoteProgress(progress: FormattedStatus) {
41+
const lastStatus = this._latestStatus?.downloadStatus;
42+
4143
this._latestStatus = progress;
4244
this.emit1("progress", progress);
43-
const isStatusChanged = this._latestStatus?.downloadStatus !== progress.downloadStatus;
45+
const isStatusChanged = lastStatus !== progress.downloadStatus;
4446

4547
if (!isStatusChanged) {
4648
return;

0 commit comments

Comments
 (0)