summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-27 11:02:50 -0500
committerJeff Carr <[email protected]>2024-10-27 11:02:50 -0500
commit8fc2fbd9c9a6f05852cd597b246f0b4e634af7d7 (patch)
tree707c6044781eb4ef1f3ed9c4b756f6e605e4b6c8 /main.go
parentd38865a6cf3d9e11803e9f565a0dd0c763de479d (diff)
track droplets reported from each hypervisor
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/main.go b/main.go
index 1168355..fe827eb 100644
--- a/main.go
+++ b/main.go
@@ -38,16 +38,17 @@ func main() {
}
// set defaults
- me.unstable = time.Now() // initialize the grid as unstable
- me.delay = 5 * time.Second // how often to poll the hypervisors
+ me.unstable = time.Now() // initialize the grid as unstable
me.changed = false
- // me.dmap = make(map[*pb.Droplet]*DropletT)
me.hmap = make(map[*pb.Hypervisor]*HyperT)
// how long a droplet can be missing until it's declared dead
me.unstableTimeout = 17 * time.Second
me.missingDropletTimeout = time.Minute // not sure the difference between these values
+ // how often to poll the hypervisors
+ me.hyperPollDelay = 5 * time.Second
+
// how long the cluster must be stable before new droplets can be started
me.clusterStableDuration = 37 * time.Second
@@ -141,12 +142,14 @@ func main() {
log.Println("result:", result)
os.Exit(0)
}
+
// initialize each hypervisor
for _, pbh := range me.cluster.Hypervisors {
// this is a new unknown droplet (not in the config file)
- h := new(HyperT)
+ var h *HyperT
+ h = new(HyperT)
h.pb = pbh
-
+ h.lastDroplets = make(map[string]time.Time)
h.lastpoll = time.Now()
me.hmap[pbh] = h