mirror of
https://github.com/status-im/go-watchdog.git
synced 2025-02-04 21:53:24 +00:00
8676adea5c
This commit introduces the cgroup-driven watchdog. It can be initialized by calling watchdog.CgroupDriven(). This watchdog infers the limit from the process' cgroup, which is either derived from /proc/self/cgroup, or from the root cgroup if the PID == 1 (running in a container). Tests have been added/refactored to accommodate running locally and in a Docker container. Certain test cases now must be isolated from one another, to prevent side-effects from dirty go runtimes. A Makefile has been introduced to run all tests.
14 lines
300 B
Go
14 lines
300 B
Go
// +build !linux
|
|
|
|
package watchdog
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// CgroupDriven is only available in Linux. This method will error.
|
|
func CgroupDriven(frequency time.Duration, policyCtor PolicyCtor) (err error, stopFn func()) {
|
|
return fmt.Errorf("cgroups-driven watchdog: %w", ErrNotSupported), nil
|
|
}
|