higher precision for connection speed updates
Massimo Melina committed
Feb 9, 2022 at 14:54 UTC
fe8f93219dadfd56a85c1671c2ca4c16a586191c
1 file changed
+1
-1
src/throttler.ts
+1
-1
@@ -37,7 +37,7 @@ export function throttler(): Koa.Middleware {
37
const conn = socket2connection(ctx.socket)
38
if (conn)
39
ts.on('sent', _.debounce(() =>
40
- updateConnection(conn, { sent: ts.getBytesSent(), outSpeed: Math.round(ts.getSpeed()) }), 1000, { maxWait:1000 }))
40
+ updateConnection(conn, { sent: ts.getBytesSent(), outSpeed: _.round(ts.getSpeed(),1) }), 1000, { maxWait:1000 }))
41
42
const bak = ctx.response.length // preserve
43
ctx.body = ctx.body.pipe(ts)