Cleaned-up the cleanup loop
This commit is contained in:
@@ -75,7 +75,13 @@ func NewBackend(keyTable Table[ApiKey], apps ...App) (*Backend, error) {
|
||||
}
|
||||
|
||||
func (b *Backend) cleanupLoop() {
|
||||
b.cleanup()
|
||||
for range time.Tick(24 * time.Hour) {
|
||||
b.cleanup()
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Backend) cleanup() {
|
||||
old := getDate(time.Now().Add(-30 * 24 * time.Hour))
|
||||
var err error
|
||||
for _, a := range b.apps {
|
||||
@@ -89,7 +95,6 @@ func (b *Backend) cleanupLoop() {
|
||||
log.Printf("error removing old logs for %v: %v\n", a.AppID(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enable CORS for with the given cors address
|
||||
|
||||
Reference in New Issue
Block a user