diff options
| author | Jeff Carr <[email protected]> | 2025-03-21 19:30:02 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-22 09:45:32 -0500 |
| commit | b5925dcdce2f91c23f522a6541f628a2be3e3ece (patch) | |
| tree | fd3d57fd698b34948ddfd2a0c402bb2d61927341 /http.go | |
| parent | 687e97ab09980560baa45cd2f55ab9d01bbaa741 (diff) | |
uptime ignores unresponsive hosts
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 } |
