From e83df05a6964d14c33e026ebbecb4b44ae46fb99 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 26 May 2019 12:45:43 +0200 Subject: [PATCH] Log watchdog/status interactions --- src/Application.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index a4112003d..8113f74f8 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -425,7 +425,7 @@ appMain = runResourceT $ do Just wInterval | maybe True (== myProcessID) watchdogProcess -> let notifyWatchdog :: IO () - notifyWatchdog = forever $ do + notifyWatchdog = runAppLoggingT foundation . forever $ do d <- liftIO . newDelay . floor $ wInterval % 2 status <- atomically $ asum @@ -438,14 +438,16 @@ appMain = runResourceT $ do ] case status of - Just (_, Min status') -> void . Systemd.notifyStatus . unpack $ toPathPiece status' + Just (_, Min status') -> do + $logInfoS "NotifyStatus" $ toPathPiece status' + liftIO . void . Systemd.notifyStatus . unpack $ toPathPiece status' Nothing -> return () case status of - Just (_, Min HealthSuccess) - -> void Systemd.notifyWatchdog - _other - -> return () + Just (_, Min HealthSuccess) -> do + $logInfoS "NotifyWatchdog" "Notify" + liftIO $ void Systemd.notifyWatchdog + _other -> return () in void $ allocate (async notifyWatchdog >>= \a -> a <$ link a) cancel _other -> return ()