diff --git a/FinalCommander.go b/FinalCommander.go index 4322242..045e454 100644 --- a/FinalCommander.go +++ b/FinalCommander.go @@ -45,7 +45,6 @@ type ContentServer struct { Address string Weight uint LastCheckResult bool - LastCheck time.Time LastCheckMutex sync.RWMutex } @@ -441,11 +440,8 @@ func handle(w http.ResponseWriter, r *http.Request) { } func checkContentServers() { - checkTime := time.Now().Add(-15 * time.Minute) for _, c := range contentServers { - if c.LastCheck.Before(checkTime) { - c.check() - } + c.check() } } @@ -507,13 +503,18 @@ func main() { Address: p[0], Weight: uint(weight), LastCheckResult: false, - LastCheck: time.Date(1970, 0, 0, 0, 0, 0, 0, time.UTC), }) } - //TODO: cron this checkContentServers() + go func() { + ticker := time.NewTicker(1 * time.Minute) + for _ = range ticker.C { + checkContentServers() + } + }() + sniAddress = strings.ToLower(*sniAddressOption) bogusCertificatePEM, bogusKeyPairPEM := createSelfSignedCertificate()