feat: T1007 System Service Discovery - fixed allowlist probe in posture heartbeat

This commit is contained in:
AetherForge
2026-05-30 23:16:50 -07:00
parent 4207f6c21b
commit d010292333
26 changed files with 2499 additions and 134 deletions

View File

@@ -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)
}
}()
}