fix(health): monitor flush by check interval not flush interval
This commit is contained in:
parent
fb7b63394a
commit
03226eca6a
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user