mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-30 01:36:28 -05:00
8a92054c2b
* Added JSDoc to eslint rules Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com> * Fixed JSDoc eslint errors Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com> * Update the check-linters workflow to Node.js 20 --------- Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com> Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
28 lines
841 B
JavaScript
28 lines
841 B
JavaScript
const { R } = require("redbean-node");
|
|
const { log } = require("../../src/util");
|
|
const Database = require("../database");
|
|
|
|
/**
|
|
* Run incremental_vacuum and checkpoint the WAL.
|
|
* @returns {Promise<void>} A promise that resolves when the process is finished.
|
|
*/
|
|
|
|
const incrementalVacuum = async () => {
|
|
try {
|
|
if (Database.dbConfig.type !== "sqlite") {
|
|
log.debug("incrementalVacuum", "Skipping incremental_vacuum, not using SQLite.");
|
|
return;
|
|
}
|
|
|
|
log.debug("incrementalVacuum", "Running incremental_vacuum and wal_checkpoint(PASSIVE)...");
|
|
await R.exec("PRAGMA incremental_vacuum(200)");
|
|
await R.exec("PRAGMA wal_checkpoint(PASSIVE)");
|
|
} catch (e) {
|
|
log.error("incrementalVacuum", `Failed: ${e.message}`);
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
incrementalVacuum,
|
|
};
|