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 { AccountService } from './account-service';
|
||||||
import { SchedulerService } from './scheduler-service';
|
import { SchedulerService } from './scheduler-service';
|
||||||
|
|
||||||
|
// TODO: will be moved to scheduler feature directory
|
||||||
export const scheduleServices = (
|
export const scheduleServices = (
|
||||||
services: IUnleashServices,
|
services: IUnleashServices,
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
@ -54,6 +55,7 @@ export const scheduleServices = (
|
|||||||
instanceStatsService,
|
instanceStatsService,
|
||||||
clientInstanceService,
|
clientInstanceService,
|
||||||
projectService,
|
projectService,
|
||||||
|
projectHealthService,
|
||||||
} = services;
|
} = services;
|
||||||
|
|
||||||
schedulerService.schedule(
|
schedulerService.schedule(
|
||||||
@ -84,6 +86,11 @@ export const scheduleServices = (
|
|||||||
hoursToMilliseconds(24),
|
hoursToMilliseconds(24),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
schedulerService.schedule(
|
||||||
|
projectHealthService.setHealthRating.bind(projectHealthService),
|
||||||
|
hoursToMilliseconds(1),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createServices = (
|
export const createServices = (
|
||||||
|
@ -8,8 +8,6 @@ import type {
|
|||||||
IFeatureTypeStore,
|
IFeatureTypeStore,
|
||||||
} from '../types/stores/feature-type-store';
|
} from '../types/stores/feature-type-store';
|
||||||
import type { IProjectStore } from '../types/stores/project-store';
|
import type { IProjectStore } from '../types/stores/project-store';
|
||||||
import { hoursToMilliseconds } from 'date-fns';
|
|
||||||
import Timer = NodeJS.Timer;
|
|
||||||
import ProjectService from './project-service';
|
import ProjectService from './project-service';
|
||||||
import {
|
import {
|
||||||
calculateProjectHealth,
|
calculateProjectHealth,
|
||||||
@ -27,8 +25,6 @@ export default class ProjectHealthService {
|
|||||||
|
|
||||||
private featureTypes: IFeatureType[];
|
private featureTypes: IFeatureType[];
|
||||||
|
|
||||||
private healthRatingTimer: Timer;
|
|
||||||
|
|
||||||
private projectService: ProjectService;
|
private projectService: ProjectService;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -48,10 +44,6 @@ export default class ProjectHealthService {
|
|||||||
this.featureTypeStore = featureTypeStore;
|
this.featureTypeStore = featureTypeStore;
|
||||||
this.featureToggleStore = featureToggleStore;
|
this.featureToggleStore = featureToggleStore;
|
||||||
this.featureTypes = [];
|
this.featureTypes = [];
|
||||||
this.healthRatingTimer = setInterval(
|
|
||||||
() => this.setHealthRating(),
|
|
||||||
hoursToMilliseconds(1),
|
|
||||||
).unref();
|
|
||||||
|
|
||||||
this.projectService = projectService;
|
this.projectService = projectService;
|
||||||
}
|
}
|
||||||
@ -106,8 +98,4 @@ export default class ProjectHealthService {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(): void {
|
|
||||||
clearInterval(this.healthRatingTimer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user