diff options
Diffstat (limited to 'watchdog.go')
| -rw-r--r-- | watchdog.go | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/watchdog.go b/watchdog.go deleted file mode 100644 index d9491b9..0000000 --- a/watchdog.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2017-2025 WIT.COM Inc. All rights reserved. -// Use of this source code is governed by the GPL 3.0 - -package main - -import ( - "fmt" - "os" - "time" -) - -// timeFunction takes a function as an argument and returns the execution time. -func TimeFunction(f func()) time.Duration { - startTime := time.Now() // Record the start time - f() // Execute the function - return time.Since(startTime) // Calculate the elapsed time -} - -func zood() { - me.dog = time.NewTicker(me.pollDelay) - defer me.dog.Stop() - done := make(chan bool) - for { - select { - case <-done: - fmt.Println("Done!") - return - case _ = <-me.dog.C: - s := me.machine.UpdatePackages() - me.failcount += 1 - sendMachine(s) - - if me.failcount > 20 { - os.Exit(0) - } - } - } - /* - // this example would exit/destroy the ticker in 10 seconds - go func() { - time.Sleep(10 * time.Second) - done <- true - }() - */ -} |
