mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +01:00
fix: remove migration and health rating check
This commit is contained in:
parent
aa4102c022
commit
60383af1e3
@ -56,12 +56,6 @@ class ProjectStore {
|
||||
return rows.map(this.mapRow);
|
||||
}
|
||||
|
||||
async updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void> {
|
||||
await this.db(TABLE)
|
||||
.where({ id: healthUpdate.id })
|
||||
.update({ health: healthUpdate.health });
|
||||
}
|
||||
|
||||
async get(id: string): Promise<IProject> {
|
||||
return this.db
|
||||
.first(COLUMNS)
|
||||
|
@ -26,8 +26,6 @@ export default class ProjectHealthService {
|
||||
|
||||
private featureTypes: Map<string, number>;
|
||||
|
||||
private healthRatingTimer: Timer;
|
||||
|
||||
constructor(
|
||||
{
|
||||
projectStore,
|
||||
@ -44,10 +42,6 @@ export default class ProjectHealthService {
|
||||
this.featureTypeStore = featureTypeStore;
|
||||
this.featureToggleStore = featureToggleStore;
|
||||
this.featureTypes = new Map();
|
||||
this.healthRatingTimer = setInterval(
|
||||
() => this.setHealthRating(),
|
||||
MILLISECONDS_IN_ONE_HOUR,
|
||||
).unref();
|
||||
}
|
||||
|
||||
async getProjectHealthReport(
|
||||
@ -148,22 +142,4 @@ export default class ProjectHealthService {
|
||||
);
|
||||
return rating;
|
||||
}
|
||||
|
||||
async setHealthRating(): Promise<void> {
|
||||
const projects = await this.projectStore.getAll();
|
||||
|
||||
await Promise.all(
|
||||
projects.map(async project => {
|
||||
const newHealth = await this.calculateHealthRating(project);
|
||||
await this.projectStore.updateHealth({
|
||||
id: project.id,
|
||||
health: newHealth,
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
clearInterval(this.healthRatingTimer);
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
exports.up = function(db, cb) {
|
||||
db.runSql(
|
||||
`
|
||||
ALTER TABLE projects ADD COLUMN health integer DEFAULT 100;
|
||||
`,
|
||||
cb,
|
||||
);
|
||||
};
|
||||
|
||||
exports.down = function(db, cb) {
|
||||
db.runSql(
|
||||
`
|
||||
ALTER TABLE projects DROP COLUMN health;
|
||||
`,
|
||||
cb,
|
||||
);
|
||||
};
|
||||
|
||||
exports._meta = {
|
||||
version: 1,
|
||||
};
|
Loading…
Reference in New Issue
Block a user