Cleaned-up the cleanup loop

This commit is contained in:
Caleb Gardner
2025-05-08 02:24:54 -05:00
parent 24b99d7d1e
commit 3e1078efec
+6 -1
View File
@@ -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 {
@@ -90,7 +96,6 @@ func (b *Backend) cleanupLoop() {
}
}
}
}
// Enable CORS for with the given cors address
func (b *Backend) AddCorsAddress(corsAddr string) {