trilium/src/routes/api/cleanup.js

20 lines
480 B
JavaScript
Raw Normal View History

"use strict";
const sql = require('../../services/sql');
2017-12-24 02:16:18 +08:00
const log = require('../../services/log');
2019-12-11 05:03:00 +08:00
const consistencyChecksService = require('../../services/consistency_checks');
2018-01-08 03:07:59 +08:00
async function vacuumDatabase() {
await sql.execute("VACUUM");
2017-12-24 02:16:18 +08:00
log.info("Database has been vacuumed.");
}
2017-12-24 02:16:18 +08:00
2019-12-11 05:03:00 +08:00
async function findAndFixConsistencyIssues() {
await consistencyChecksService.runOnDemandChecks(true);
}
module.exports = {
2019-12-11 05:03:00 +08:00
vacuumDatabase,
findAndFixConsistencyIssues
};