From ae21fd8a11055f4d57d926a6aab69ff4c1183882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Thu, 13 Jan 2022 09:06:14 +0100 Subject: [PATCH] Add logging for ActionServe --- cmd/apiary.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/apiary.go b/cmd/apiary.go index 3504f8f..47b609e 100644 --- a/cmd/apiary.go +++ b/cmd/apiary.go @@ -235,12 +235,17 @@ func ActionServe(c *cli.Context) error { ticker := time.NewTicker(timeout / 2) for { + // TODO: Consider using ctx with deadline to avoid healthcheck taking more time than ticker, + // which will result in being killed by watchdog. healthy := s.IsHealthy() select { case <-ticker.C: if healthy == nil { daemon.SdNotify(false, daemon.SdNotifyWatchdog) + continue } + // TODO: If unhealthy, should we retry healthcheck immediately, otherwise service will most likely get killed by watchdog. + loggers.rootLogger.Errorw("Store reported not healthy, might get killed by watchdog.", "err", healthy) case <-notifyCtx.Done(): loggers.rootLogger.Debugw("Notify context cancelled.") return