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
|
dispatchHealthCheckDoesFlush = fmap HealthDoesFlush . runMaybeT $ do
|
||||||
UniWorX{ appSettings' = AppSettings{..}, appJobState } <- getYesod
|
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
|
lFlush <- MaybeT . atomically $ do
|
||||||
jState <- tryReadTMVar appJobState
|
jState <- tryReadTMVar appJobState
|
||||||
fmap join . for jState $ \JobState{jobContext} -> readTVar $ jobLastFlush jobContext
|
fmap join . for jState $ \JobState{jobContext} -> readTVar $ jobLastFlush jobContext
|
||||||
|
|
||||||
now <- liftIO getCurrentTime
|
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 )
|
HealthActiveJobExecutors (Just prop )
|
||||||
| prop <= 0 -> HealthFailure
|
| prop <= 0 -> HealthFailure
|
||||||
HealthDoesFlush (Just prop )
|
HealthDoesFlush (Just prop )
|
||||||
| prop >= 2 -> HealthFailure
|
| prop >= 1 -> HealthFailure
|
||||||
_other -> maxBound -- Minimum badness
|
_other -> maxBound -- Minimum badness
|
||||||
|
|||||||
Reference in New Issue
Block a user