2019-07-29 15:43:53 +02:00
|
|
|
const Setting = require('lib/models/Setting');
|
|
|
|
const ItemChange = require('lib/models/ItemChange');
|
2019-01-14 21:11:54 +02:00
|
|
|
|
|
|
|
class ItemChangeUtils {
|
|
|
|
static async deleteProcessedChanges() {
|
2019-07-29 15:43:53 +02:00
|
|
|
const lastProcessedChangeIds = [Setting.value('resourceService.lastProcessedChangeId'), Setting.value('searchEngine.lastProcessedChangeId'), Setting.value('revisionService.lastProcessedChangeId')];
|
2019-01-14 21:11:54 +02:00
|
|
|
|
|
|
|
const lowestChangeId = Math.min(...lastProcessedChangeIds);
|
|
|
|
await ItemChange.deleteOldChanges(lowestChangeId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-29 15:43:53 +02:00
|
|
|
module.exports = ItemChangeUtils;
|