mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 21:37:34 -07:00
Use sum function (#3174)
This commit is contained in:
parent
58d1e65e33
commit
4c6daa3f46
1 changed files with 4 additions and 3 deletions
|
@ -19,6 +19,7 @@ import webFinger from './webfinger';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import networkChart from '../chart/network';
|
import networkChart from '../chart/network';
|
||||||
import apiServer from './api';
|
import apiServer from './api';
|
||||||
|
import { sum } from '../prelude/array';
|
||||||
|
|
||||||
// Init app
|
// Init app
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
|
@ -99,9 +100,9 @@ export default () => new Promise(resolve => {
|
||||||
if (queue.length == 0) return;
|
if (queue.length == 0) return;
|
||||||
|
|
||||||
const requests = queue.length;
|
const requests = queue.length;
|
||||||
const time = queue.reduce((a, b) => a + b.time, 0);
|
const time = sum(queue.map(x => x.time));
|
||||||
const incomingBytes = queue.reduce((a, b) => a + b.req.bytes, 0);
|
const incomingBytes = sum(queue.map(x => x.req.byets));
|
||||||
const outgoingBytes = queue.reduce((a, b) => a + b.res.bytes, 0);
|
const outgoingBytes = sum(queue.map(x => x.res.byets));
|
||||||
queue = [];
|
queue = [];
|
||||||
|
|
||||||
networkChart.update(requests, time, incomingBytes, outgoingBytes);
|
networkChart.update(requests, time, incomingBytes, outgoingBytes);
|
||||||
|
|
Loading…
Reference in a new issue