summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-12 11:54:01 -0500
committerJeff Carr <[email protected]>2024-10-12 11:54:01 -0500
commit487c6fd11c2746a71fee1a6b562e41fbb2486382 (patch)
tree9b586687707d3778856ef285fdd88d583c3b8eb7 /http.go
parenta6b385e21628989b9c14958fdaaca00fbf1f4663 (diff)
polling duration times work
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'http.go')
-rw-r--r--http.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/http.go b/http.go
index 2188ed5..e4c9401 100644
--- a/http.go
+++ b/http.go
@@ -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
}