feat: T1007 System Service Discovery - fixed allowlist probe in posture heartbeat
This commit is contained in:
@@ -9,17 +9,23 @@ import (
|
||||
"crypto-miner-server/internal/db"
|
||||
)
|
||||
|
||||
// retentionTickInterval is the delay between scheduled retention passes (overridable in tests).
|
||||
var retentionTickInterval = 6 * time.Hour
|
||||
|
||||
// runRetentionFn is the work function invoked by StartRetentionJobs (overridable in tests).
|
||||
var runRetentionFn = runRetention
|
||||
|
||||
// StartRetentionJobs purges old stats and build artifacts on an interval.
|
||||
func StartRetentionJobs(database *db.Database, dataDir string, statsHours, buildDays int) {
|
||||
if statsHours <= 0 && buildDays <= 0 {
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
runRetention(database, dataDir, statsHours, buildDays)
|
||||
ticker := time.NewTicker(6 * time.Hour)
|
||||
runRetentionFn(database, dataDir, statsHours, buildDays)
|
||||
ticker := time.NewTicker(retentionTickInterval)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
runRetention(database, dataDir, statsHours, buildDays)
|
||||
runRetentionFn(database, dataDir, statsHours, buildDays)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user