global hypervisor poll delay
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
5b99a88e06
commit
a3ea303ab8
|
@ -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)
|
||||
|
|
3
main.go
3
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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue