diff options
| author | Jeff Carr <[email protected]> | 2024-11-15 19:24:57 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-15 19:24:57 -0600 |
| commit | 9d265e0445164f6ef169bb490f3fe9d97a4ef473 (patch) | |
| tree | ceabc82d6a84b977b39508f3a3088283be4ed171 /watchdog.go | |
| parent | fbd638aec099fc88c5bd616dff891bb942d2de4b (diff) | |
zood connects
Diffstat (limited to 'watchdog.go')
| -rw-r--r-- | watchdog.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/watchdog.go b/watchdog.go index d70ccbf..e685b7b 100644 --- a/watchdog.go +++ b/watchdog.go @@ -14,10 +14,18 @@ func TimeFunction(f func()) time.Duration { return time.Since(startTime) // Calculate the elapsed time } +func shutdownDog() { + // this example would exit/destroy the ticker in 10 seconds + go func() { + time.Sleep(10 * time.Second) + me.dogchan <- true + }() +} + func NewWatchdog() { me.dog = time.NewTicker(me.pollDelay) defer me.dog.Stop() - done := make(chan bool) + me.dogchan = make(chan bool) /* // this example would exit/destroy the ticker in 10 seconds go func() { @@ -27,12 +35,11 @@ func NewWatchdog() { */ for { select { - case <-done: + case <-me.dogchan: fmt.Println("Done!") return case t := <-me.dog.C: log.Info("Watchdog() ticked", me.zookeeper, "Current time: ", t) - updatePackages() // h.pollHypervisor() // h.Scan() } |
