Log if timeout is invalid

This commit is contained in:
Torjus Håkestad 2021-11-06 01:46:09 +01:00
parent a1526c9334
commit 056ac87eee

View File

@ -196,7 +196,6 @@ func ActionServe(c *cli.Context) error {
loggers.rootLogger.Warnw("Unable to connect to NOTIFY_SOCKET to notify watchdog.", "error", err) loggers.rootLogger.Warnw("Unable to connect to NOTIFY_SOCKET to notify watchdog.", "error", err)
return return
} }
time.Sleep(1 * time.Second)
// Setup timer // Setup timer
timeout, err := daemon.SdWatchdogEnabled(false) timeout, err := daemon.SdWatchdogEnabled(false)
@ -204,7 +203,10 @@ func ActionServe(c *cli.Context) error {
loggers.rootLogger.Warnw("Unable to connect to NOTIFY_SOCKET to get watchdog timeout.", "error", err) loggers.rootLogger.Warnw("Unable to connect to NOTIFY_SOCKET to get watchdog timeout.", "error", err)
return return
} }
loggers.rootLogger.Debugw("Got timeout", "timeout", timeout) if timeout < 0 {
loggers.rootLogger.Debugw("Got invalid watchdog timeout", "timeout", timeout)
return
}
ticker := time.NewTicker(timeout / 2) ticker := time.NewTicker(timeout / 2)
for { for {
healthy := s.IsHealthy() healthy := s.IsHealthy()