summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/system
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-02-06 00:13:52 +0900
committerGitHub <noreply@github.com>2022-02-06 00:13:52 +0900
commitc1b264e4e9686804e1b8ea17ba39753c41bd205b (patch)
tree041e794b683cf986f98fcc04a3d5a50a8dcb7554 /packages/backend/src/queue/processors/system
parentenhance(client): improve chart rendering (diff)
downloadsharkey-c1b264e4e9686804e1b8ea17ba39753c41bd205b.tar.gz
sharkey-c1b264e4e9686804e1b8ea17ba39753c41bd205b.tar.bz2
sharkey-c1b264e4e9686804e1b8ea17ba39753c41bd205b.zip
Improve chart engine (#8253)
* wip * wip * wip * wip * wip * wip * wip * Update core.ts * wip * wip * #7361 * delete network chart * federationChart強化 apRequestChart追加 * tweak
Diffstat (limited to 'packages/backend/src/queue/processors/system')
-rw-r--r--packages/backend/src/queue/processors/system/clean-charts.ts28
-rw-r--r--packages/backend/src/queue/processors/system/index.ts2
2 files changed, 30 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..fd156def9e
--- /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(`Resync 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();
+}
diff --git a/packages/backend/src/queue/processors/system/index.ts b/packages/backend/src/queue/processors/system/index.ts
index 8460ea0a9b..636fefc402 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 { resyncCharts } from './resync-charts';
+import { cleanCharts } from './clean-charts';
const jobs = {
resyncCharts,
+ cleanCharts,
} as Record<string, Bull.ProcessCallbackFunction<Record<string, unknown>> | Bull.ProcessPromiseFunction<Record<string, unknown>>>;
export default function(dbQueue: Bull.Queue<Record<string, unknown>>) {