Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/cvetool/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,8 @@ func update(c *cli.Context) error {
if err := lv.FetchUpdates(ctx); err != nil {
return fmt.Errorf("error updating vulnerabilities: %v", err)
}
if err := matcherStore.VacuumDatabase(ctx); err != nil {
return fmt.Errorf("error vacuum database : %v", err)
}
return nil
}
13 changes: 13 additions & 0 deletions datastore/sqlite_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,19 @@ func (ms *sqliteMatcherStore) GC(ctx context.Context, count int) (int64, error)
return 0, nil
}

func (ms *sqliteMatcherStore) VacuumDatabase(ctx context.Context) error {
zlog.Debug(ctx).Msg(">>> VacuumDatabase")
const (
vacuum = "VACUUM;"
)
_, err := ms.conn.Exec(vacuum)
if err != nil {
return fmt.Errorf("failed to vacuum database: %v", err)
}
zlog.Info(ctx).Msg("finished database vacuum")
return nil
}

// RecordUpdaterStatus records that an updater is up to date with vulnerabilities at this time
func (ms *sqliteMatcherStore) RecordUpdaterStatus(ctx context.Context, updaterName string, updateTime time.Time, fingerprint driver.Fingerprint, updaterError error) error {
zlog.Debug(ctx).Msg(">>> RecordUpdaterStatus")
Expand Down