Merge branch 'perf/local-dbupd' into perf/local-opt

This commit is contained in:
2026-10-16 10:20:59 +07:00
21 changed files with 1323 additions and 58 deletions
+8 -2
View File
@@ -500,11 +500,17 @@ function startBackgroundServices() {
.catch(() => {});
// Hourly DB upkeep: a non-blocking checkpoint (the WAL then shrinks to
// journal_size_limit) and PRAGMA optimize. Off with DASHBOARD_DB_MAINTAIN_MS=0.
// journal_size_limit), PRAGMA optimize, the opt-in retention
// (AGENTHUB_RETENTION_DAYS, off by default) and a bounded incremental_vacuum
// (server/lib/db-retention.js). Off with DASHBOARD_DB_MAINTAIN_MS=0.
{
const every = Number(process.env.DASHBOARD_DB_MAINTAIN_MS ?? 60 * 60 * 1000);
if (every > 0) {
const t = setInterval(() => require("./db").maintainDatabase(), every);
const t = setInterval(() => {
require("./lib/db-retention")
.runScheduledMaintenance()
.catch(() => {});
}, every);
if (t.unref) t.unref();
}
}