1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

Schedule health report (#3025)

This commit is contained in:
Mateusz Kwasniewski 2023-01-31 13:35:16 +01:00 committed by GitHub
parent 59e8e2b1ed
commit dc8c95702f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 12 deletions

View File

@ -44,6 +44,7 @@ import { hoursToMilliseconds, minutesToMilliseconds } from 'date-fns';
import { AccountService } from './account-service';
import { SchedulerService } from './scheduler-service';
// TODO: will be moved to scheduler feature directory
export const scheduleServices = (
services: IUnleashServices,
config: IUnleashConfig,
@ -54,6 +55,7 @@ export const scheduleServices = (
instanceStatsService,
clientInstanceService,
projectService,
projectHealthService,
} = services;
schedulerService.schedule(
@ -84,6 +86,11 @@ export const scheduleServices = (
hoursToMilliseconds(24),
);
}
schedulerService.schedule(
projectHealthService.setHealthRating.bind(projectHealthService),
hoursToMilliseconds(1),
);
};
export const createServices = (

View File

@ -8,8 +8,6 @@ import type {
IFeatureTypeStore,
} from '../types/stores/feature-type-store';
import type { IProjectStore } from '../types/stores/project-store';
import { hoursToMilliseconds } from 'date-fns';
import Timer = NodeJS.Timer;
import ProjectService from './project-service';
import {
calculateProjectHealth,
@ -27,8 +25,6 @@ export default class ProjectHealthService {
private featureTypes: IFeatureType[];
private healthRatingTimer: Timer;
private projectService: ProjectService;
constructor(
@ -48,10 +44,6 @@ export default class ProjectHealthService {
this.featureTypeStore = featureTypeStore;
this.featureToggleStore = featureToggleStore;
this.featureTypes = [];
this.healthRatingTimer = setInterval(
() => this.setHealthRating(),
hoursToMilliseconds(1),
).unref();
this.projectService = projectService;
}
@ -106,8 +98,4 @@ export default class ProjectHealthService {
}),
);
}
destroy(): void {
clearInterval(this.healthRatingTimer);
}
}