From 00f1a201772a04d3b1f65753ed23138cb92ec7b0 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Fri, 16 Feb 2024 18:08:30 +0100 Subject: [PATCH] Round progress to 4th digit to prevent weird progress bar behavior on reconnect --- public/scripts/network.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/network.js b/public/scripts/network.js index 2fa5760..af4900c 100644 --- a/public/scripts/network.js +++ b/public/scripts/network.js @@ -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'});