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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user