summaryrefslogtreecommitdiff
path: root/watchdog.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-15 19:24:57 -0600
committerJeff Carr <[email protected]>2024-11-15 19:24:57 -0600
commit9d265e0445164f6ef169bb490f3fe9d97a4ef473 (patch)
treeceabc82d6a84b977b39508f3a3088283be4ed171 /watchdog.go
parentfbd638aec099fc88c5bd616dff891bb942d2de4b (diff)
zood connects
Diffstat (limited to 'watchdog.go')
-rw-r--r--watchdog.go13
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()
}