mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
feat: remove instances older than 1 day not 2 days (#9944)
This commit is contained in:
parent
7a012ce910
commit
e414c4446d
@ -61,9 +61,9 @@ export default class ClientInstanceStore implements IClientInstanceStore {
|
||||
});
|
||||
}
|
||||
|
||||
async removeInstancesOlderThanTwoDays(): Promise<void> {
|
||||
async removeOldInstances(): Promise<void> {
|
||||
const rows = await this.db(TABLE)
|
||||
.whereRaw("last_seen < now() - interval '2 days'")
|
||||
.whereRaw("last_seen < now() - interval '1 days'")
|
||||
.del();
|
||||
|
||||
if (rows > 0) {
|
||||
|
@ -316,8 +316,8 @@ export default class ClientInstanceService {
|
||||
await this.clientApplicationsStore.upsert(input);
|
||||
}
|
||||
|
||||
async removeInstancesOlderThanTwoDays(): Promise<void> {
|
||||
return this.clientInstanceStore.removeInstancesOlderThanTwoDays();
|
||||
async removeOldInstances(): Promise<void> {
|
||||
return this.clientInstanceStore.removeOldInstances();
|
||||
}
|
||||
|
||||
async removeInactiveApplications(): Promise<number> {
|
||||
|
@ -72,9 +72,7 @@ export const scheduleServices = async (
|
||||
);
|
||||
|
||||
schedulerService.schedule(
|
||||
clientInstanceService.removeInstancesOlderThanTwoDays.bind(
|
||||
clientInstanceService,
|
||||
),
|
||||
clientInstanceService.removeOldInstances.bind(clientInstanceService),
|
||||
hoursToMilliseconds(24),
|
||||
'removeInstancesOlderThanTwoDays',
|
||||
);
|
||||
|
@ -35,5 +35,5 @@ export interface IClientInstanceStore
|
||||
getDistinctApplications(): Promise<string[]>;
|
||||
getDistinctApplicationsCount(daysBefore?: number): Promise<number>;
|
||||
deleteForApplication(appName: string): Promise<void>;
|
||||
removeInstancesOlderThanTwoDays(): Promise<void>;
|
||||
removeOldInstances(): Promise<void>;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ export default class FakeClientInstanceStore implements IClientInstanceStore {
|
||||
this.instances.push({ createdAt: new Date(), ...details });
|
||||
}
|
||||
|
||||
removeInstancesOlderThanTwoDays(): Promise<void> {
|
||||
removeOldInstances(): Promise<void> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user