mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-21 06:12:17 +03:00
Migration 046 seeds databaseSettings.autoVacuumMode="INCREMENTAL" into the key_value config store for every database it runs against (new and pre-existing), but never touches the live SQLite auto_vacuum pragma — that requires a VACUUM, which the migration correctly avoids running blindly. The only automatic startup path deliberately skipped applying it too (to avoid a blocking VACUUM at boot, the hazard #12821 tracks), with no drift detection or self-correction, so the config permanently reported INCREMENTAL while the live pragma stayed NONE. Fix: applyStoredDatabaseOptimizationSettings() now detects the drift at startup (log + persisted record, never a synchronous VACUUM), and vacuumScheduler.runNow() reconciles it out-of-request on its next scheduled run (announced one-time conversion VACUUM), then switches to a bounded PRAGMA incremental_vacuum batch instead of an unconditional full VACUUM once INCREMENTAL is actually in effect. Regression test: tests/unit/issue-13432-auto-vacuum-drift.test.ts