m-lab / ndt-server

docker native ndt5 and ndt7 server with prometheus integration
https://www.measurementlab.net/
Apache License 2.0
99 stars 40 forks source link

Use performance.now() where available #379

Closed robertodauria closed 1 year ago

robertodauria commented 1 year ago

This PR changes the NDT5 client code to use the monotonic performance.now() instead of Date.now() where available. This fixes a rare bug that happens when the system clock is changed while a measurement is running, which would cause an incorrect client-side throughput to be displayed -- in extreme cases, even a negative value.

(The code is basically the same as in ndt7-js)


This change is Reviewable

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 1637


Files with Coverage Reduction New Missed Lines %
ndt5/ndt5.go 2 88.95%
metrics/metrics.go 4 60.0%
ndt5/c2s/c2s.go 4 71.43%
ndt7/upload/sender/sender.go 5 65.91%
<!-- Total: 15 -->
Totals Coverage Status
Change from base Build 1634: -0.7%
Covered Lines: 1815
Relevant Lines: 2228

💛 - Coveralls