chore(sqlite): allow periodic database maintenance to be disabled (#10441)

This change allows the periodic database maintenance to be disabled, while providing a way to programmatically start maintenance at a convenient moment.

Signed-off-by: Tommy van der Vorst <tommy@pixelspark.nl>
This commit is contained in:
Tommy van der Vorst
2026-01-14 21:10:54 +00:00
committed by GitHub
parent ed0baec2ca
commit 5bf27a432c
4 changed files with 40 additions and 9 deletions
+8 -1
View File
@@ -72,6 +72,7 @@ type App struct {
stopOnce sync.Once
mainServiceCancel context.CancelFunc
stopped chan struct{}
dbService db.DBService
// Access to internals for direct users of this package. Note that the interface in Internals is unstable!
Internals *Internals
@@ -114,10 +115,16 @@ func (a *App) Start() error {
return nil
}
// StartMaintenance asynchronously triggers database maintenance to start.
func (a *App) StartMaintenance() {
a.dbService.StartMaintenance()
}
func (a *App) startup() error {
a.mainService.Add(ur.NewFailureHandler(a.cfg, a.evLogger))
a.mainService.Add(a.sdb.Service(a.opts.DBMaintenanceInterval))
a.dbService = a.sdb.Service(a.opts.DBMaintenanceInterval)
a.mainService.Add(a.dbService)
if a.opts.AuditWriter != nil {
a.mainService.Add(newAuditService(a.opts.AuditWriter, a.evLogger))