Commit c3528ffa authored by martin hou's avatar martin hou

fix: 降低汇报频率

parent 1321c9ce
......@@ -1015,6 +1015,7 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
this.onprogress = null;
this.onreceive = null;
this._progress_report = {};
let self = this;
// try { onprogress(0); } catch(e) {}
this.onprogress = onprogress;
this.onreceive = function(recvBytes)
......@@ -1024,8 +1025,8 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
if (percent % 5 == 0 && percent > 0 && percent < 100)
{
Logger.info('jensen', 'file-transfer', percent);
!this._progress_report[k] && onprogress?.(recvBytes);
this._progress_report[k] = true;
!(k in self._progress_report) && onprogress?.(recvBytes);
self._progress_report[k] = true;
}
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