summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configfiles.go1
-rw-r--r--main.go3
-rw-r--r--structs.go4
-rw-r--r--watchdog.go6
4 files changed, 8 insertions, 6 deletions
diff --git a/configfiles.go b/configfiles.go
index d9ba578..3146e1b 100644
--- a/configfiles.go
+++ b/configfiles.go
@@ -36,7 +36,6 @@ func readConfigFile() {
h = new(HyperT)
h.pb = pbh
- h.Delay = 5 * time.Second
h.lastpoll = time.Now()
me.hypers = append(me.hypers, h)
diff --git a/main.go b/main.go
index 0ba073a..169dcf5 100644
--- a/main.go
+++ b/main.go
@@ -35,6 +35,9 @@ func main() {
// initialize the grid as unstable
me.unstable = time.Now()
+ // how often to poll the hypervisors
+ me.delay = 5 * time.Second
+
/*
log.Info("command line hypervisors:", argv.Hosts)
for _, name := range argv.Hosts {
diff --git a/structs.go b/structs.go
index 5e6201e..b7ce4c4 100644
--- a/structs.go
+++ b/structs.go
@@ -24,6 +24,7 @@ type virtigoT struct {
names []string
hypers []*HyperT
droplets []*DropletT
+ delay time.Duration // how often to poll the hypervisors
killcount int
unstable time.Time // the last time the cluster was incorrect
}
@@ -31,8 +32,7 @@ type virtigoT struct {
// the stuff that is needed for a hypervisor
type HyperT struct {
pb *pb.Hypervisor // the Hypervisor protobuf
- Delay time.Duration // how often to poll the hypervisor
- Dog *time.Ticker // the watchdog timer itself
+ dog *time.Ticker // the watchdog timer itself
lastpoll time.Time // the last time the hypervisor polled
killcount int
}
diff --git a/watchdog.go b/watchdog.go
index 6e4aed6..e3a4f0c 100644
--- a/watchdog.go
+++ b/watchdog.go
@@ -15,8 +15,8 @@ func TimeFunction(f func()) time.Duration {
}
func (h *HyperT) NewWatchdog() {
- h.Dog = time.NewTicker(h.Delay)
- defer h.Dog.Stop()
+ h.dog = time.NewTicker(me.delay)
+ defer h.dog.Stop()
done := make(chan bool)
/*
// this example would exit/destroy the ticker in 10 seconds
@@ -30,7 +30,7 @@ func (h *HyperT) NewWatchdog() {
case <-done:
fmt.Println("Done!")
return
- case t := <-h.Dog.C:
+ case t := <-h.dog.C:
log.Log(POLL, "Watchdog() ticked", h.pb.Hostname, "Current time: ", t)
h.pollHypervisor()
// h.Scan()