Skip to content

Commit

Permalink
Round progress to 4th digit to prevent weird progress bar behavior on…
Browse files Browse the repository at this point in the history
… reconnect
  • Loading branch information
schlagmichdoch committed Feb 17, 2024
1 parent 3c8848d commit 00f1a20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion public/scripts/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,9 @@ class Peer {
return;
}

// While transferring -> round progress to 4th digit. After transferring, set it to 1.
let progress = this._digester
? (this._totalBytesReceived + this._digester._bytesReceived) / this._acceptedRequest.totalSize
? Math.floor(1e4 * (this._totalBytesReceived + this._digester._bytesReceived) / this._acceptedRequest.totalSize) / 1e4
: 1;

Events.fire('set-progress', {peerId: this._peerId, progress: progress, status: 'receive'});
Expand Down

0 comments on commit 00f1a20

Please sign in to comment.