update aggregation logic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-16 08:32:12 +11:00
parent f0bacab729
commit 268919219e
3 changed files with 10 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"
"log/slog"
"strings"
"time"
@@ -338,13 +339,18 @@ func ApplySQLiteTuning(ctx context.Context, dbConn *sqlx.DB) {
return
}
// Best-effort pragmas; ignore errors to stay safe in constrained environments.
var err error
pragmas := []string{
`PRAGMA journal_mode=WAL;`,
`PRAGMA synchronous=NORMAL;`,
`PRAGMA temp_store=MEMORY;`,
`PRAGMA optimize;`,
}
for _, pragma := range pragmas {
_, _ = dbConn.ExecContext(ctx, pragma)
_, err = dbConn.ExecContext(ctx, pragma)
if logger, ok := ctx.Value("logger").(*slog.Logger); ok && logger != nil {
logger.Debug("Applied SQLite tuning pragma", "pragma", pragma, "error", err)
}
}
}