From 056ac87eee60f54c9b066936ce7bffe75903ace3 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 6 Nov 2021 01:46:09 +0100 Subject: [PATCH] Log if timeout is invalid --- cmd/apiary.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/apiary.go b/cmd/apiary.go index e57762a..e6b8cfb 100644 --- a/cmd/apiary.go +++ b/cmd/apiary.go @@ -196,7 +196,6 @@ func ActionServe(c *cli.Context) error { loggers.rootLogger.Warnw("Unable to connect to NOTIFY_SOCKET to notify watchdog.", "error", err) return } - time.Sleep(1 * time.Second) // Setup timer 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) 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) for { healthy := s.IsHealthy()