diff options
| author | Jeff Carr <[email protected]> | 2024-10-13 04:34:55 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-13 04:34:55 -0500 |
| commit | ccbdef1a1340571110d9867499b0801ff19c681c (patch) | |
| tree | 1890cab5e70268ddf23eb896120cd28cd352bebc /http.go | |
| parent | 425e75d388beb3f00e527e89ef81a35fd5b6e931 (diff) | |
checking for the grid to be 'stable' before starting new droplets
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -85,8 +85,23 @@ func okHandler(w http.ResponseWriter, r *http.Request) { if tmp == "/start" { start := r.URL.Query().Get("start") - log.Info("should start droplet here", start) - fmt.Fprintln(w, "should start droplet here", start) + log.Info("Handling URL:", tmp, "start droplet", start) + dur := time.Since(me.unstable) // how long has the cluster been stable? + + fmt.Fprintln(w, "should start droplet here", start, shell.FormatDuration(dur)) + if dur < 17*time.Second { + fmt.Fprintln(w, "grid is still to unstable") + return + } + d := findDroplet(start) + if d == nil { + fmt.Fprintln(w, "can't start unknown droplet", start) + return + } + for _, h := range me.hypers { + fmt.Fprintln(w, "could start droplet on", start, "on", h.Hostname, h.Active) + } + return } |
