watchdog: add LOTUS_DISABLE_WATCHDOG escape hatch.
This commit is contained in:
parent
d033f8aab1
commit
f9cbf6d526
@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gbrlsnchs/jwt/v3"
|
||||
@ -30,6 +31,13 @@ import (
|
||||
"github.com/raulk/go-watchdog"
|
||||
)
|
||||
|
||||
const (
|
||||
// EnvWatchdogDisabled is an escape hatch to disable the watchdog explicitly
|
||||
// in case an OS/kernel appears to report incorrect information. The
|
||||
// watchdog will be disabled if the value of this env variable is 1.
|
||||
EnvWatchdogDisabled = "LOTUS_DISABLE_WATCHDOG"
|
||||
)
|
||||
|
||||
const (
|
||||
JWTSecretName = "auth-jwt-private" //nolint:gosec
|
||||
KTJwtHmacSecret = "jwt-hmac-secret" //nolint:gosec
|
||||
@ -62,6 +70,11 @@ func MemoryConstraints() system.MemoryConstraints {
|
||||
// MemoryWatchdog starts the memory watchdog, applying the computed resource
|
||||
// constraints.
|
||||
func MemoryWatchdog(lc fx.Lifecycle, constraints system.MemoryConstraints) {
|
||||
if os.Getenv(EnvWatchdogDisabled) == "1" {
|
||||
log.Infof("memory watchdog is disabled via %s", EnvWatchdogDisabled)
|
||||
return
|
||||
}
|
||||
|
||||
cfg := watchdog.MemConfig{
|
||||
Resolution: 5 * time.Second,
|
||||
Policy: &watchdog.WatermarkPolicy{
|
||||
|
Loading…
Reference in New Issue
Block a user