Refactor
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import { driveChart } from '../../../../services/stats';
|
||||
import { driveStats } from '../../../../services/stats';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) throw psErr;
|
||||
|
||||
const stats = await driveChart.getStats(ps.span as any, ps.limit);
|
||||
const stats = await driveStats.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import { networkChart } from '../../../../services/stats';
|
||||
import { networkStats } from '../../../../services/stats';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) throw psErr;
|
||||
|
||||
const stats = await networkChart.getStats(ps.span as any, ps.limit);
|
||||
const stats = await networkStats.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import { notesChart } from '../../../../services/stats';
|
||||
import { notesStats } from '../../../../services/stats';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) throw psErr;
|
||||
|
||||
const stats = await notesChart.getStats(ps.span as any, ps.limit);
|
||||
const stats = await notesStats.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'cafy';
|
||||
import getParams from '../../get-params';
|
||||
import { usersChart } from '../../../../services/stats';
|
||||
import { usersStats } from '../../../../services/stats';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@ -27,7 +27,7 @@ export default (params: any) => new Promise(async (res, rej) => {
|
||||
const [ps, psErr] = getParams(meta, params);
|
||||
if (psErr) throw psErr;
|
||||
|
||||
const stats = await usersChart.getStats(ps.span as any, ps.limit);
|
||||
const stats = await usersStats.getChart(ps.span as any, ps.limit);
|
||||
|
||||
res(stats);
|
||||
});
|
||||
|
@ -7,7 +7,7 @@ import generateUserToken from '../common/generate-native-user-token';
|
||||
import config from '../../../config';
|
||||
import Meta from '../../../models/meta';
|
||||
import RegistrationTicket from '../../../models/registration-tickets';
|
||||
import { usersChart } from '../../../services/stats';
|
||||
import { usersStats } from '../../../services/stats';
|
||||
|
||||
if (config.recaptcha) {
|
||||
recaptcha.init({
|
||||
@ -130,7 +130,7 @@ export default async (ctx: Koa.Context) => {
|
||||
}, { upsert: true });
|
||||
//#endregion
|
||||
|
||||
usersChart.update(account, true);
|
||||
usersStats.update(account, true);
|
||||
|
||||
const res = await pack(account, account, {
|
||||
detail: true,
|
||||
|
@ -17,7 +17,7 @@ const requestStats = require('request-stats');
|
||||
import activityPub from './activitypub';
|
||||
import webFinger from './webfinger';
|
||||
import config from '../config';
|
||||
import { networkChart } from '../services/stats';
|
||||
import { networkStats } from '../services/stats';
|
||||
import apiServer from './api';
|
||||
|
||||
// Init app
|
||||
@ -104,7 +104,7 @@ export default () => new Promise(resolve => {
|
||||
const outgoingBytes = queue.reduce((a, b) => a + b.res.bytes, 0);
|
||||
queue = [];
|
||||
|
||||
networkChart.update(requests, time, incomingBytes, outgoingBytes);
|
||||
networkStats.update(requests, time, incomingBytes, outgoingBytes);
|
||||
}, 5000);
|
||||
//#endregion
|
||||
});
|
||||
|
Reference in New Issue
Block a user