summaryrefslogtreecommitdiff
path: root/event.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-31 05:02:20 -0500
committerJeff Carr <[email protected]>2024-10-31 05:02:20 -0500
commit748f9b4608ccc03f71f40bf961948816a662b1ba (patch)
treee24f78109e3eb9a221e73125b9b54602b82df82b /event.go
parent123f64f56c480c9b40eb88010fe91701c33de0af (diff)
compiles. maybe works on some stuff still
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'event.go')
-rw-r--r--event.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/event.go b/event.go
index a2406b9..f8569f1 100644
--- a/event.go
+++ b/event.go
@@ -26,6 +26,9 @@ func (h *HyperT) RestartVirtigod() {
}
// checks if the cluster is ready and stable
+// func (c *Cluster) DropletReady(d *Droplet) (bool, string) {
+
+/*
func clusterReady() (bool, string) {
last := time.Since(me.unstable)
if last > me.unstableTimeout {
@@ -36,30 +39,24 @@ func clusterReady() (bool, string) {
log.Warn("clusterReady() is unstable for", shell.FormatDuration(last))
return false, "clusterReady() is unstable for " + shell.FormatDuration(last)
}
+*/
+/*
func dropletReady(d *pb.Droplet) (bool, string) {
- if d.CurrentState == pb.DropletState_ON {
+ if d.Current.State == pb.DropletState_ON {
return false, "EVENT start droplet is already ON"
}
- if d.Starts > 2 {
+ if d.Current.StartAttempts > 2 {
// reason := "EVENT start droplet has already been started " + d.starts + " times"
return false, fmt.Sprintln("EVENT start droplet has already been started ", d.Starts, " times")
}
return true, ""
}
+*/
// this must be bool in string because accumulated output is sometimes
// written to STDOUT, sometimes to http
func (h *HyperT) start(d *pb.Droplet) (bool, string) {
- ready, result := clusterReady()
- if !ready {
- return false, result
- }
- ready, result = dropletReady(d)
- if !ready {
- return false, result
- }
-
url := "http://" + h.pb.Hostname + ":2520/start?start=" + d.Hostname
var msg string
var data []byte
@@ -72,15 +69,9 @@ func (h *HyperT) start(d *pb.Droplet) (bool, string) {
log.Info("http post url:", url)
log.Info("http post data:", msg)
- result = "EVENT start droplet url: " + url + "\n"
+ result := "EVENT start droplet url: " + url + "\n"
result += "EVENT start droplet response: " + string(req)
- // increment the counter for a start attempt working
- d.Starts += 1
-
- // mark the cluster as unstable so droplet starts can be throttled
- me.unstable = time.Now()
-
return true, result
}