incrementalVacuum for sqlite only

This commit is contained in:
Louis Lam 2023-08-09 21:05:15 +08:00
parent 83307b3446
commit e001fd7d1c

View File

@ -1,5 +1,6 @@
const { R } = require("redbean-node"); const { R } = require("redbean-node");
const { log } = require("../../src/util"); const { log } = require("../../src/util");
const Database = require("../database");
/** /**
* Run incremental_vacuum and checkpoint the WAL. * Run incremental_vacuum and checkpoint the WAL.
@ -8,6 +9,11 @@ const { log } = require("../../src/util");
const incrementalVacuum = async () => { const incrementalVacuum = async () => {
try { 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)..."); log.debug("incrementalVacuum", "Running incremental_vacuum and wal_checkpoint(PASSIVE)...");
await R.exec("PRAGMA incremental_vacuum(200)"); await R.exec("PRAGMA incremental_vacuum(200)");
await R.exec("PRAGMA wal_checkpoint(PASSIVE)"); await R.exec("PRAGMA wal_checkpoint(PASSIVE)");