rudeshark.net/packages/backend/src/queue/processors/system/tick-charts.ts

45 lines
990 B
TypeScript
Raw Normal View History

2023-01-13 05:40:33 +01:00
import type Bull from "bull";
2022-02-10 09:45:12 +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-10 09:45:12 +01:00
2023-01-13 05:40:33 +01:00
const logger = queueLogger.createSubLogger("tick-charts");
2022-02-10 09:45:12 +01:00
2023-01-13 05:40:33 +01:00
export async function tickCharts(
job: Bull.Job<Record<string, unknown>>,
done: any,
): Promise<void> {
logger.info("Tick charts...");
2022-02-10 09:45:12 +01:00
await Promise.all([
federationChart.tick(false),
notesChart.tick(false),
usersChart.tick(false),
activeUsersChart.tick(false),
instanceChart.tick(false),
perUserNotesChart.tick(false),
driveChart.tick(false),
perUserReactionsChart.tick(false),
hashtagChart.tick(false),
perUserFollowingChart.tick(false),
perUserDriveChart.tick(false),
apRequestChart.tick(false),
]);
2023-01-13 05:40:33 +01:00
logger.succ("All charts successfully ticked.");
2022-02-10 09:45:12 +01:00
done();
}