summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/system/resync-charts.ts
blob: 20012513aff1c2325757132f74d5cc0d9080bcd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import Bull from 'bull';

import { queueLogger } from '../../logger.js';
import { driveChart, notesChart, usersChart } from '@/services/chart/index.js';

const logger = queueLogger.createSubLogger('resync-charts');

export async function resyncCharts(job: Bull.Job<Record<string, unknown>>, done: any): Promise<void> {
	logger.info(`Resync charts...`);

	// TODO: ユーザーごとのチャートも更新する
	// TODO: インスタンスごとのチャートも更新する
	await Promise.all([
		driveChart.resync(),
		notesChart.resync(),
		usersChart.resync(),
	]);

	logger.succ(`All charts successfully resynced.`);
	done();
}