summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-21 19:30:02 -0500
committerJeff Carr <[email protected]>2025-03-22 09:45:32 -0500
commitb5925dcdce2f91c23f522a6541f628a2be3e3ece (patch)
treefd3d57fd698b34948ddfd2a0c402bb2d61927341 /http.go
parent687e97ab09980560baa45cd2f55ab9d01bbaa741 (diff)
uptime ignores unresponsive hosts
Diffstat (limited to 'http.go')
-rw-r--r--http.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/http.go b/http.go
index 7534b87..cc19929 100644
--- a/http.go
+++ b/http.go
@@ -8,6 +8,7 @@ import (
"io/ioutil"
"net/http"
"strings"
+ "time"
"go.wit.com/log"
)
@@ -83,10 +84,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
var count int
var bad int
- all := me.machines.All()
- for all.Scan() {
- m := all.Next()
+ for m := range me.machines.IterAll() {
count += 1
+ if m.SinceLastUpdate() > 10*time.Minute {
+ // skip machines that have not been updated in the last 10 minutes
+ log.Info("ignoring old machine", m.Hostname)
+ continue
+ }
if findVersion(m, "zood") != me.zood.version {
bad += 1
}