2023-07-26 22:31:52 -07:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-08-04 18:33:00 -07:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2022-09-17 11:27:08 -07:00
|
|
|
import type Logger from '@/logger.js';
|
|
|
|
import FederationChart from '@/core/chart/charts/federation.js';
|
|
|
|
import NotesChart from '@/core/chart/charts/notes.js';
|
|
|
|
import UsersChart from '@/core/chart/charts/users.js';
|
|
|
|
import ActiveUsersChart from '@/core/chart/charts/active-users.js';
|
|
|
|
import InstanceChart from '@/core/chart/charts/instance.js';
|
|
|
|
import PerUserNotesChart from '@/core/chart/charts/per-user-notes.js';
|
2023-01-01 00:45:49 -08:00
|
|
|
import PerUserPvChart from '@/core/chart/charts/per-user-pv.js';
|
2022-09-17 11:27:08 -07:00
|
|
|
import DriveChart from '@/core/chart/charts/drive.js';
|
|
|
|
import PerUserReactionsChart from '@/core/chart/charts/per-user-reactions.js';
|
|
|
|
import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js';
|
|
|
|
import PerUserDriveChart from '@/core/chart/charts/per-user-drive.js';
|
|
|
|
import ApRequestChart from '@/core/chart/charts/ap-request.js';
|
2023-01-01 00:45:49 -08:00
|
|
|
import { bindThis } from '@/decorators.js';
|
2022-09-17 11:27:08 -07:00
|
|
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
2023-05-28 19:54:49 -07:00
|
|
|
import type * as Bull from 'bullmq';
|
2022-09-17 11:27:08 -07:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class TickChartsProcessorService {
|
2022-09-18 11:11:50 -07:00
|
|
|
private logger: Logger;
|
2022-09-17 11:27:08 -07:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
private federationChart: FederationChart,
|
|
|
|
private notesChart: NotesChart,
|
|
|
|
private usersChart: UsersChart,
|
|
|
|
private activeUsersChart: ActiveUsersChart,
|
|
|
|
private instanceChart: InstanceChart,
|
|
|
|
private perUserNotesChart: PerUserNotesChart,
|
2023-01-01 00:45:49 -08:00
|
|
|
private perUserPvChart: PerUserPvChart,
|
2022-09-17 11:27:08 -07:00
|
|
|
private driveChart: DriveChart,
|
|
|
|
private perUserReactionsChart: PerUserReactionsChart,
|
|
|
|
private perUserFollowingChart: PerUserFollowingChart,
|
|
|
|
private perUserDriveChart: PerUserDriveChart,
|
|
|
|
private apRequestChart: ApRequestChart,
|
|
|
|
|
|
|
|
private queueLoggerService: QueueLoggerService,
|
|
|
|
) {
|
2022-09-18 11:11:50 -07:00
|
|
|
this.logger = this.queueLoggerService.logger.createSubLogger('tick-charts');
|
2022-09-17 11:27:08 -07:00
|
|
|
}
|
|
|
|
|
2022-12-03 22:03:09 -08:00
|
|
|
@bindThis
|
2023-05-28 19:54:49 -07:00
|
|
|
public async process(): Promise<void> {
|
2022-09-18 11:11:50 -07:00
|
|
|
this.logger.info('Tick charts...');
|
2022-09-17 11:27:08 -07:00
|
|
|
|
|
|
|
await Promise.all([
|
|
|
|
this.federationChart.tick(false),
|
|
|
|
this.notesChart.tick(false),
|
|
|
|
this.usersChart.tick(false),
|
|
|
|
this.activeUsersChart.tick(false),
|
|
|
|
this.instanceChart.tick(false),
|
|
|
|
this.perUserNotesChart.tick(false),
|
2023-01-01 00:45:49 -08:00
|
|
|
this.perUserPvChart.tick(false),
|
2022-09-17 11:27:08 -07:00
|
|
|
this.driveChart.tick(false),
|
|
|
|
this.perUserReactionsChart.tick(false),
|
|
|
|
this.perUserFollowingChart.tick(false),
|
|
|
|
this.perUserDriveChart.tick(false),
|
|
|
|
this.apRequestChart.tick(false),
|
|
|
|
]);
|
|
|
|
|
2022-09-18 11:11:50 -07:00
|
|
|
this.logger.succ('All charts successfully ticked.');
|
2022-09-17 11:27:08 -07:00
|
|
|
}
|
|
|
|
}
|