v0.32.6_fix2
This commit is contained in:
1 parent
e1ac899ec0
commit
fc8711d4d8
39 files changed
+695
-232
No files matched your search
@@ -88,17 +88,17 @@ window.rustProxyStreamDashboard = (() => {
|
||||
const rxTotal = views.reduce((sum, view) => sum + (Number(view.bytes_in) || 0), 0);
|
||||
const txTotal = views.reduce((sum, view) => sum + (Number(view.bytes_out) || 0), 0);
|
||||
const now = performance.now();
|
||||
let rx = 0, tx = 0;
|
||||
if (history.last) {
|
||||
const seconds = Math.max(.001, (now - history.last.when) / 1000);
|
||||
if (rxTotal >= history.last.rx) rx = (rxTotal - history.last.rx) / seconds;
|
||||
if (txTotal >= history.last.tx) tx = (txTotal - history.last.tx) / seconds;
|
||||
const sample = rustProxyRateSampling.difference(history.last, [rxTotal, txTotal], now, rustProxyRateSampling.cadence("overview_seconds"));
|
||||
const pausedRate = history.last !== null && sample.deltas === null;
|
||||
history.last = sample.next;
|
||||
const rx = sample.deltas ? sample.deltas[0] / sample.seconds : 0;
|
||||
const tx = sample.deltas ? sample.deltas[1] / sample.seconds : 0;
|
||||
if (!pausedRate) {
|
||||
history.rx.push(rx); history.tx.push(tx);
|
||||
if (history.rx.length > 60) { history.rx.shift(); history.tx.shift(); }
|
||||
}
|
||||
history.last = { when: now, rx: rxTotal, tx: txTotal };
|
||||
history.rx.push(rx); history.tx.push(tx);
|
||||
if (history.rx.length > 60) { history.rx.shift(); history.tx.shift(); }
|
||||
set("stream-dashboard-traffic", `${bytes(Math.round(rx))}/s`);
|
||||
trafficRates(`${bytes(Math.round(rx))}/s`, `${bytes(Math.round(tx))}/s`);
|
||||
set("stream-dashboard-traffic", pausedRate ? "-" : `${bytes(Math.round(rx))}/s`);
|
||||
trafficRates(pausedRate ? "-" : `${bytes(Math.round(rx))}/s`, pausedRate ? "-" : `${bytes(Math.round(tx))}/s`);
|
||||
$("stream-dashboard-rx")?.setAttribute("points", line(history.rx));
|
||||
$("stream-dashboard-tx")?.setAttribute("points", line(history.tx));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user