summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/system/clean-charts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/queue/processors/system/clean-charts.ts')
-rw-r--r--packages/backend/src/queue/processors/system/clean-charts.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/backend/src/queue/processors/system/clean-charts.ts b/packages/backend/src/queue/processors/system/clean-charts.ts
new file mode 100644
index 0000000000..3ae0f495f8
--- /dev/null
+++ b/packages/backend/src/queue/processors/system/clean-charts.ts
@@ -0,0 +1,28 @@
+import * as Bull from 'bull';
+
+import { queueLogger } from '../../logger';
+import { activeUsersChart, driveChart, federationChart, hashtagChart, instanceChart, notesChart, perUserDriveChart, perUserFollowingChart, perUserNotesChart, perUserReactionsChart, usersChart, apRequestChart } from '@/services/chart/index';
+
+const logger = queueLogger.createSubLogger('clean-charts');
+
+export async function cleanCharts(job: Bull.Job<Record<string, unknown>>, done: any): Promise<void> {
+ logger.info(`Clean charts...`);
+
+ 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(),
+ ]);
+
+ logger.succ(`All charts successfully cleaned.`);
+ done();
+}