diff --git a/db.go b/db.go index 001509d5d..fb7dedacf 100644 --- a/db.go +++ b/db.go @@ -187,8 +187,16 @@ func Open(dir string, l log.Logger, r prometheus.Registerer, opts *Options) (db func (db *DB) run() { defer close(db.donec) + tick := time.NewTicker(30 * time.Second) + defer tick.Stop() + for { select { + case <-tick.C: + select { + case db.compactc <- struct{}{}: + default: + } case <-db.compactc: db.metrics.compactionsTriggered.Inc()