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
| 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 ()