reduce log spam from charts
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { ChartLoggerService } from '@/core/chart/ChartLoggerService.js';
|
||||
import Logger from '@/logger.js';
|
||||
import FederationChart from './charts/federation.js';
|
||||
import NotesChart from './charts/notes.js';
|
||||
import UsersChart from './charts/users.js';
|
||||
@@ -24,6 +26,7 @@ import type { OnApplicationShutdown } from '@nestjs/common';
|
||||
export class ChartManagementService implements OnApplicationShutdown {
|
||||
private charts;
|
||||
private saveIntervalId: NodeJS.Timeout;
|
||||
private readonly logger: Logger;
|
||||
|
||||
constructor(
|
||||
private federationChart: FederationChart,
|
||||
@@ -38,6 +41,7 @@ export class ChartManagementService implements OnApplicationShutdown {
|
||||
private perUserFollowingChart: PerUserFollowingChart,
|
||||
private perUserDriveChart: PerUserDriveChart,
|
||||
private apRequestChart: ApRequestChart,
|
||||
private chartLoggerService: ChartLoggerService,
|
||||
) {
|
||||
this.charts = [
|
||||
this.federationChart,
|
||||
@@ -53,6 +57,7 @@ export class ChartManagementService implements OnApplicationShutdown {
|
||||
this.perUserDriveChart,
|
||||
this.apRequestChart,
|
||||
];
|
||||
this.logger = chartLoggerService.logger;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -62,6 +67,7 @@ export class ChartManagementService implements OnApplicationShutdown {
|
||||
for (const chart of this.charts) {
|
||||
chart.save();
|
||||
}
|
||||
this.logger.info('All charts saved');
|
||||
}, 1000 * 60 * 20);
|
||||
}
|
||||
|
||||
@@ -72,6 +78,7 @@ export class ChartManagementService implements OnApplicationShutdown {
|
||||
await Promise.all(
|
||||
this.charts.map(chart => chart.save()),
|
||||
);
|
||||
this.logger.info('All charts saved');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user