From 04d4dd323f43992f08be038d0583e3a5f03e9f44 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Sun, 16 Oct 2022 18:22:18 -0400 Subject: [PATCH] backend: use time constant in services/chart/index.ts --- packages/backend/src/services/chart/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/services/chart/index.ts b/packages/backend/src/services/chart/index.ts index 8bf2d8f65..0fc2e7ff2 100644 --- a/packages/backend/src/services/chart/index.ts +++ b/packages/backend/src/services/chart/index.ts @@ -1,5 +1,6 @@ import { beforeShutdown } from '@/misc/before-shutdown.js'; +import { MINUTE } from '@/const.js'; import FederationChart from './charts/federation.js'; import NotesChart from './charts/notes.js'; import UsersChart from './charts/users.js'; @@ -41,11 +42,11 @@ const charts = [ apRequestChart, ]; -// 20分おきにメモリ情報をDBに書き込み +// Write memory information to DB every 20 minutes setInterval(() => { for (const chart of charts) { chart.save(); } -}, 1000 * 60 * 20); +}, 20 * MINUTE); beforeShutdown(() => Promise.all(charts.map(chart => chart.save())));