Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix: round bandwidth stats #3735

Merged
merged 2 commits into from
Jul 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/ipfs-core/src/components/stats/bw.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ function getBandwidthStats (libp2p, opts) {
const { movingAverages, snapshot } = stats

return {
totalIn: BigInt(snapshot.dataReceived.toString()),
totalOut: BigInt(snapshot.dataSent.toString()),
rateIn: BigInt(movingAverages.dataReceived[60000].movingAverage() / 60),
rateOut: BigInt(movingAverages.dataSent[60000].movingAverage() / 60)
totalIn: BigInt(snapshot.dataReceived.integerValue().toString()),
totalOut: BigInt(snapshot.dataSent.integerValue().toString()),
rateIn: BigInt(Math.round(movingAverages.dataReceived[60000].movingAverage() / 60)),
rateOut: BigInt(Math.round(movingAverages.dataSent[60000].movingAverage() / 60))
}
}

Expand Down