diff options
| author | Jeff Carr <[email protected]> | 2024-10-12 11:54:01 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-12 11:54:01 -0500 |
| commit | 487c6fd11c2746a71fee1a6b562e41fbb2486382 (patch) | |
| tree | 9b586687707d3778856ef285fdd88d583c3b8eb7 /http.go | |
| parent | a6b385e21628989b9c14958fdaaca00fbf1f4663 (diff) | |
polling duration times work
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4,8 +4,10 @@ import ( "fmt" "net/http" "strings" + "time" "go.wit.com/log" + "go.wit.com/lib/gui/shell" ) // remove '?' part and trailing '/' @@ -18,7 +20,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { var tmp string tmp = cleanURL(r.URL.Path) - log.Info("Got URL:", tmp) + log.Info("Handling URL:", tmp) if tmp == "/" { fmt.Fprintln(w, "OK") return @@ -30,7 +32,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) { if tmp == "/vms" { for _, d := range me.droplets { - fmt.Fprintln(w, d.Hostname, d.hname, d.lastpoll) + dur := time.Since(d.lastpoll) // Calculate the elapsed time + fmt.Fprintln(w, d.Hostname, d.hname, shell.FormatDuration(dur)) } return } |
