Improve chart performance (#7360)
* wip * wip * wip * wip * wip * Update chart.ts * wip * Improve server performance * wip * wip
This commit is contained in:
parent
0d19c2d42e
commit
4f249159d3
32 changed files with 889 additions and 161 deletions
|
|
@ -36,6 +36,50 @@ export default class InstanceChart extends Chart<InstanceLog> {
|
|||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected aggregate(logs: InstanceLog[]): InstanceLog {
|
||||
return {
|
||||
requests: {
|
||||
failed: logs.reduce((a, b) => a + b.requests.failed, 0),
|
||||
succeeded: logs.reduce((a, b) => a + b.requests.succeeded, 0),
|
||||
received: logs.reduce((a, b) => a + b.requests.received, 0),
|
||||
},
|
||||
notes: {
|
||||
total: logs[0].notes.total,
|
||||
inc: logs.reduce((a, b) => a + b.notes.inc, 0),
|
||||
dec: logs.reduce((a, b) => a + b.notes.dec, 0),
|
||||
diffs: {
|
||||
reply: logs.reduce((a, b) => a + b.notes.diffs.reply, 0),
|
||||
renote: logs.reduce((a, b) => a + b.notes.diffs.renote, 0),
|
||||
normal: logs.reduce((a, b) => a + b.notes.diffs.normal, 0),
|
||||
},
|
||||
},
|
||||
users: {
|
||||
total: logs[0].users.total,
|
||||
inc: logs.reduce((a, b) => a + b.users.inc, 0),
|
||||
dec: logs.reduce((a, b) => a + b.users.dec, 0),
|
||||
},
|
||||
following: {
|
||||
total: logs[0].following.total,
|
||||
inc: logs.reduce((a, b) => a + b.following.inc, 0),
|
||||
dec: logs.reduce((a, b) => a + b.following.dec, 0),
|
||||
},
|
||||
followers: {
|
||||
total: logs[0].followers.total,
|
||||
inc: logs.reduce((a, b) => a + b.followers.inc, 0),
|
||||
dec: logs.reduce((a, b) => a + b.followers.dec, 0),
|
||||
},
|
||||
drive: {
|
||||
totalFiles: logs[0].drive.totalFiles,
|
||||
totalUsage: logs[0].drive.totalUsage,
|
||||
incFiles: logs.reduce((a, b) => a + b.drive.incFiles, 0),
|
||||
incUsage: logs.reduce((a, b) => a + b.drive.incUsage, 0),
|
||||
decFiles: logs.reduce((a, b) => a + b.drive.decFiles, 0),
|
||||
decUsage: logs.reduce((a, b) => a + b.drive.decUsage, 0),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async fetchActual(group: string): Promise<DeepPartial<InstanceLog>> {
|
||||
const [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue