2023-01-13 05:40:33 +01:00
|
|
|
import type Bull from "bull";
|
2022-02-05 16:13:52 +01:00
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
import { queueLogger } from "../../logger.js";
|
|
|
|
import {
|
|
|
|
activeUsersChart,
|
|
|
|
driveChart,
|
|
|
|
federationChart,
|
|
|
|
hashtagChart,
|
|
|
|
instanceChart,
|
|
|
|
notesChart,
|
|
|
|
perUserDriveChart,
|
|
|
|
perUserFollowingChart,
|
|
|
|
perUserNotesChart,
|
|
|
|
perUserReactionsChart,
|
|
|
|
usersChart,
|
|
|
|
apRequestChart,
|
|
|
|
} from "@/services/chart/index.js";
|
2022-02-05 16:13:52 +01:00
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
const logger = queueLogger.createSubLogger("clean-charts");
|
2022-02-05 16:13:52 +01:00
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
export async function cleanCharts(
|
|
|
|
job: Bull.Job<Record<string, unknown>>,
|
|
|
|
done: any,
|
|
|
|
): Promise<void> {
|
|
|
|
logger.info("Clean charts...");
|
2022-02-05 16:13:52 +01:00
|
|
|
|
|
|
|
await Promise.all([
|
|
|
|
federationChart.clean(),
|
|
|
|
notesChart.clean(),
|
|
|
|
usersChart.clean(),
|
|
|
|
activeUsersChart.clean(),
|
|
|
|
instanceChart.clean(),
|
|
|
|
perUserNotesChart.clean(),
|
|
|
|
driveChart.clean(),
|
|
|
|
perUserReactionsChart.clean(),
|
|
|
|
hashtagChart.clean(),
|
|
|
|
perUserFollowingChart.clean(),
|
|
|
|
perUserDriveChart.clean(),
|
|
|
|
apRequestChart.clean(),
|
|
|
|
]);
|
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
logger.succ("All charts successfully cleaned.");
|
2022-02-05 16:13:52 +01:00
|
|
|
done();
|
|
|
|
}
|