diff options
Diffstat (limited to 'add.go')
| -rw-r--r-- | add.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -2,8 +2,10 @@ package virtbuf import ( "fmt" + "time" "github.com/google/uuid" + "go.wit.com/log" ) // can the json protobuf output use a string and have a type handler @@ -129,6 +131,17 @@ func (epb *Events) AppendEvent(e *Event) { epb.Events = append(epb.Events, e) } +func (c *Cluster) ClusterStable() (bool, string) { + last := time.Since(c.Unstable.AsTime()) + if last > c.UnstableTimeout.AsDuration() { + // the cluster has not been stable for 133 seconds + log.Warn("clusterReady() is stable for ", FormatDuration(c.UnstableTimeout.AsDuration()), " secs") + return true, fmt.Sprintln("clusterReady() is stable ", FormatDuration(c.UnstableTimeout.AsDuration()), " secs") + } + log.Warn("clusterReady() is unstable for", FormatDuration(last)) + return false, "clusterReady() is unstable for " + FormatDuration(last) +} + // check the cluster and droplet to make sure it's ready to start func (c *Cluster) DropletReady(d *Droplet) (bool, string) { if c == nil { |
