Log watchdog/status interactions

This commit is contained in:
Gregor Kleen 2019-05-26 12:45:43 +02:00
parent 30fe78ebdc
commit e83df05a69

View File

@ -425,7 +425,7 @@ appMain = runResourceT $ do
Just wInterval Just wInterval
| maybe True (== myProcessID) watchdogProcess | maybe True (== myProcessID) watchdogProcess
-> let notifyWatchdog :: IO () -> let notifyWatchdog :: IO ()
notifyWatchdog = forever $ do notifyWatchdog = runAppLoggingT foundation . forever $ do
d <- liftIO . newDelay . floor $ wInterval % 2 d <- liftIO . newDelay . floor $ wInterval % 2
status <- atomically $ asum status <- atomically $ asum
@ -438,14 +438,16 @@ appMain = runResourceT $ do
] ]
case status of 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 () Nothing -> return ()
case status of case status of
Just (_, Min HealthSuccess) Just (_, Min HealthSuccess) -> do
-> void Systemd.notifyWatchdog $logInfoS "NotifyWatchdog" "Notify"
_other liftIO $ void Systemd.notifyWatchdog
-> return () _other -> return ()
in void $ allocate (async notifyWatchdog >>= \a -> a <$ link a) cancel in void $ allocate (async notifyWatchdog >>= \a -> a <$ link a) cancel
_other -> return () _other -> return ()