mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
18 lines
579 B
TypeScript
18 lines
579 B
TypeScript
import Setting from '../models/Setting';
|
|
import ItemChange from '../models/ItemChange';
|
|
|
|
const dayMs = 86400000;
|
|
|
|
export default class ItemChangeUtils {
|
|
public static async deleteProcessedChanges(itemMinTtl: number = dayMs * 90) {
|
|
const lastProcessedChangeIds = [
|
|
Setting.value('resourceService.lastProcessedChangeId'),
|
|
Setting.value('searchEngine.lastProcessedChangeId'),
|
|
Setting.value('revisionService.lastProcessedChangeId'),
|
|
];
|
|
|
|
const lowestChangeId = Math.min(...lastProcessedChangeIds);
|
|
await ItemChange.deleteOldChanges(lowestChangeId, itemMinTtl);
|
|
}
|
|
}
|