diff --git a/src/Jobs/HealthReport.hs b/src/Jobs/HealthReport.hs index ec6debd87..7d26e6226 100644 --- a/src/Jobs/HealthReport.hs +++ b/src/Jobs/HealthReport.hs @@ -179,10 +179,11 @@ dispatchHealthCheckDoesFlush :: Handler HealthReport dispatchHealthCheckDoesFlush = fmap HealthDoesFlush . runMaybeT $ do UniWorX{ appSettings' = AppSettings{..}, appJobState } <- getYesod - interval <- hoistMaybe $ guardOnM (isn't _JobsOffload appJobMode) appJobFlushInterval + guard . is _Just $ guardOnM (isn't _JobsOffload appJobMode) appJobFlushInterval + checkInterval <- hoistMaybe $ appHealthCheckInterval HealthCheckDoesFlush lFlush <- MaybeT . atomically $ do jState <- tryReadTMVar appJobState fmap join . for jState $ \JobState{jobContext} -> readTVar $ jobLastFlush jobContext now <- liftIO getCurrentTime - return $ toRational (now `diffUTCTime` lFlush) / toRational interval + return $ toRational (now `diffUTCTime` lFlush) / toRational checkInterval diff --git a/src/Model/Types/Health.hs b/src/Model/Types/Health.hs index 6cacd2148..137810be8 100644 --- a/src/Model/Types/Health.hs +++ b/src/Model/Types/Health.hs @@ -95,5 +95,5 @@ healthReportStatus = \case HealthActiveJobExecutors (Just prop ) | prop <= 0 -> HealthFailure HealthDoesFlush (Just prop ) - | prop >= 2 -> HealthFailure + | prop >= 1 -> HealthFailure _other -> maxBound -- Minimum badness