aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-25 08:34:36 +0000
committerGitHub <[email protected]>2021-01-25 08:34:36 +0000
commit911ff38eae53eeba7e94a6b01d44eef568b8c476 (patch)
treecf15a498d09dca9ec7d05c499bea67bf23e1c092 /editors
parent3ab8d7a9ae1b8c5e421a4666f6693ae7278a7a3c (diff)
parent5bd84716ed6efe41a183c4ae3db364e2c49fa9cb (diff)
Merge #7415
7415: Code: reduce progress notification spam r=lnicola a=lnicola Co-authored-by: LaurenČ›iu Nicola <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/net.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index 1ab21e726..3e50d352c 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -99,13 +99,15 @@ export async function download(opts: DownloadOpts) {
99 async (progress, _cancellationToken) => { 99 async (progress, _cancellationToken) => {
100 let lastPercentage = 0; 100 let lastPercentage = 0;
101 await downloadFile(opts.url, tempFile, opts.mode, !!opts.gunzip, (readBytes, totalBytes) => { 101 await downloadFile(opts.url, tempFile, opts.mode, !!opts.gunzip, (readBytes, totalBytes) => {
102 const newPercentage = (readBytes / totalBytes) * 100; 102 const newPercentage = Math.round((readBytes / totalBytes) * 100);
103 progress.report({ 103 if (newPercentage !== lastPercentage) {
104 message: newPercentage.toFixed(0) + "%", 104 progress.report({
105 increment: newPercentage - lastPercentage 105 message: `${newPercentage.toFixed(0)}%`,
106 }); 106 increment: newPercentage - lastPercentage
107 107 });
108 lastPercentage = newPercentage; 108
109 lastPercentage = newPercentage;
110 }
109 }); 111 });
110 } 112 }
111 ); 113 );