Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-16 21:10:08 -05:00
parent 142d9ab1cb
commit 99df37ee8a
2 changed files with 23 additions and 9 deletions

View File

@ -13,6 +13,13 @@ start-all-droplets:
curl --silent http://localhost:8080/start?start=git.wit.org
curl --silent http://localhost:8080/start?start=go.wit.com
curl --silent http://localhost:8080/start?start=rdate.wit.com
curl --silent http://localhost:8080/start?start=uptime.wit.com
curl --silent http://localhost:8080/start?start=www.wit.com
curl --silent http://localhost:8080/start?start=ping.wit.com
curl --silent http://localhost:8080/start?start=wekan.wit.com
curl --silent http://localhost:8080/start?start=caddy.wit.org
curl --silent http://localhost:8080/start?start=immich.wit.org
curl --silent http://localhost:8080/start?start=bernacchi
@#curl --silent http://localhost:8080/start?start=jcarr
@# ./virtigo --start jcarr

View File

@ -25,13 +25,15 @@ func (h *HyperT) RestartDaemon() {
me.killcount += 1
}
var stableTimeout time.Duration = 43 * time.Second
// checks if the cluster is ready and stable
func clusterReady() (bool, string) {
last := time.Since(me.unstable)
if last > 133*time.Second {
if last > stableTimeout {
// the cluster has not been stable for 133 seconds
log.Warn("clusterReady() is stable for 133s")
return true, "clusterReady() is stable for 133s"
log.Warn("clusterReady() is stable for ", shell.FormatDuration(stableTimeout), " secs")
return true, fmt.Sprintln("clusterReady() is stable ", shell.FormatDuration(stableTimeout), " secs")
}
log.Warn("clusterReady() is unstable for", shell.FormatDuration(last))
return false, "clusterReady() is unstable for " + shell.FormatDuration(last)
@ -74,19 +76,24 @@ func (h *HyperT) Start(d *DropletT) (bool, string) {
func Start(name string) (bool, string) {
var result string
dur := time.Since(me.unstable) // how long has the cluster been stable?
result = fmt.Sprintln("should start droplet", name, "here. grid stable for:", shell.FormatDuration(dur))
if dur < 17*time.Second {
result += "grid is still too unstable"
return false, result
}
d := findDroplet(name)
if d == nil {
result += "can't start unknown droplet"
return false, result
}
if d.CurrentState == "ON" {
return false, "EVENT start droplet is already ON"
}
dur := time.Since(me.unstable) // how long has the cluster been stable?
result = fmt.Sprintln("should start droplet", name, "here. grid stable for:", shell.FormatDuration(dur))
if dur < 17*time.Second {
result += "grid is still too unstable"
return false, result
}
// make the list of hypervisors that are active and can start new droplets
var pool []*HyperT
for _, h := range me.hypers {