mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-05-25 16:57:54 +02:00
25 lines
412 B
Go
25 lines
412 B
Go
package audit
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// StartRetentionLoop periodically purges expired audit rows.
|
|
func StartRetentionLoop(s *Service, logger *zap.Logger) {
|
|
if s == nil {
|
|
return
|
|
}
|
|
go func() {
|
|
ticker := time.NewTicker(24 * time.Hour)
|
|
defer ticker.Stop()
|
|
for range ticker.C {
|
|
s.PurgeExpired()
|
|
if logger != nil {
|
|
logger.Debug("audit retention tick completed")
|
|
}
|
|
}
|
|
}()
|
|
}
|