Add logging for ActionServe

This commit is contained in:
Torjus Håkestad 2022-01-13 09:06:14 +01:00
parent b70d057cb8
commit ae21fd8a11

View File

@ -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