Commit 67ba2803 authored by martin hou's avatar martin hou

fix: 限制进度汇报的次数

parent 30909106
...@@ -1021,10 +1021,10 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress) ...@@ -1021,10 +1021,10 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
{ {
let percent = Math.floor(recvBytes / length * 100); let percent = Math.floor(recvBytes / length * 100);
let k = 't' + percent; let k = 't' + percent;
if (percent % 5 == 0 && percent > 0 && percent < 100) if (percent % 5 == 0 && percent > 0 && percent < 100 && (!k in this._progress_report))
{ {
Logger.info('jensen', 'file-transfer', percent); Logger.info('jensen', 'file-transfer', percent);
this._progress_report[k] && onprogress?.(recvBytes); onprogress?.(recvBytes);
this._progress_report[k] = true; this._progress_report[k] = true;
} }
if (percent == 100) if (percent == 100)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment