From 0afebcfd9e10a1c5deb98fb739e00aa73c757624 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 10 Feb 2022 17:45:12 +0900 Subject: enhance: improve federation chart --- .../backend/src/queue/processors/system/index.ts | 2 ++ .../src/queue/processors/system/tick-charts.ts | 28 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 packages/backend/src/queue/processors/system/tick-charts.ts (limited to 'packages/backend/src/queue/processors') diff --git a/packages/backend/src/queue/processors/system/index.ts b/packages/backend/src/queue/processors/system/index.ts index 636fefc402..1513ea4a84 100644 --- a/packages/backend/src/queue/processors/system/index.ts +++ b/packages/backend/src/queue/processors/system/index.ts @@ -1,8 +1,10 @@ import * as Bull from 'bull'; +import { tickCharts } from './tick-charts'; import { resyncCharts } from './resync-charts'; import { cleanCharts } from './clean-charts'; const jobs = { + tickCharts, resyncCharts, cleanCharts, } as Record> | Bull.ProcessPromiseFunction>>; diff --git a/packages/backend/src/queue/processors/system/tick-charts.ts b/packages/backend/src/queue/processors/system/tick-charts.ts new file mode 100644 index 0000000000..d53089f89c --- /dev/null +++ b/packages/backend/src/queue/processors/system/tick-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('tick-charts'); + +export async function tickCharts(job: Bull.Job>, done: any): Promise { + logger.info(`Tick charts...`); + + 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), + ]); + + logger.succ(`All charts successfully ticked.`); + done(); +} -- cgit v1.2.3-freya