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:
parent
59e8e2b1ed
commit
dc8c95702f
@ -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 = (
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user