mirror of https://git.sr.ht/~ashkeel/strimertul
Add DB garbage collection
This commit is contained in:
parent
4253875787
commit
bcb15ab4a9
11
main.go
11
main.go
|
@ -171,6 +171,17 @@ func main() {
|
|||
log.WithError(err).Error("Error while listening to module config changes")
|
||||
}()
|
||||
|
||||
// Run garbage collection every once in a while
|
||||
ticker := time.NewTicker(15 * time.Minute)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
// Run DB garbage collection until it's done
|
||||
var err error
|
||||
for err == nil {
|
||||
err = db.Client().RunValueLogGC(0.5)
|
||||
}
|
||||
}
|
||||
|
||||
// Start HTTP server
|
||||
failOnError(httpServer.Listen(), "HTTP server stopped")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue