diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-02-10 17:45:12 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-02-10 17:45:12 +0900 |
| commit | 0afebcfd9e10a1c5deb98fb739e00aa73c757624 (patch) | |
| tree | b97cc20120925fa5b4e3940c42f0f4ffd3ac575c /packages/backend/src/queue/processors/system | |
| parent | Node v16.13.2 (#8281) (diff) | |
| download | sharkey-0afebcfd9e10a1c5deb98fb739e00aa73c757624.tar.gz sharkey-0afebcfd9e10a1c5deb98fb739e00aa73c757624.tar.bz2 sharkey-0afebcfd9e10a1c5deb98fb739e00aa73c757624.zip | |
enhance: improve federation chart
Diffstat (limited to 'packages/backend/src/queue/processors/system')
| -rw-r--r-- | packages/backend/src/queue/processors/system/index.ts | 2 | ||||
| -rw-r--r-- | packages/backend/src/queue/processors/system/tick-charts.ts | 28 |
2 files changed, 30 insertions, 0 deletions
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<string, Bull.ProcessCallbackFunction<Record<string, unknown>> | Bull.ProcessPromiseFunction<Record<string, unknown>>>; 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<Record<string, unknown>>, done: any): Promise<void> { + 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(); +} |