500 instead of 204 when no report is available for too long
This commit is contained in:
parent
32512db3cb
commit
6871a695b4
@ -12,7 +12,13 @@ getHealthR :: Handler TypedContent
|
|||||||
getHealthR = do
|
getHealthR = do
|
||||||
healthReport' <- liftIO . readTVarIO =<< getsYesod appHealthReport
|
healthReport' <- liftIO . readTVarIO =<< getsYesod appHealthReport
|
||||||
case healthReport' of
|
case healthReport' of
|
||||||
Nothing -> sendResponseStatus noContent204 ()
|
Nothing -> do
|
||||||
|
interval <- getsYesod $ round . (* 1e6) . toRational . view _appHealthCheckInterval
|
||||||
|
reportStore <- getsYesod appHealthReport
|
||||||
|
waitResult <- threadDelay interval `race` atomically (readTVar reportStore >>= guard . is _Just)
|
||||||
|
case waitResult of
|
||||||
|
Left () -> fail "System is not generating HealthReports"
|
||||||
|
Right _ -> redirect HealthR
|
||||||
Just (lastUpdated, healthReport) -> do
|
Just (lastUpdated, healthReport) -> do
|
||||||
rContent <- selectRep $ do
|
rContent <- selectRep $ do
|
||||||
provideRep $
|
provideRep $
|
||||||
|
|||||||
Reference in New Issue
Block a user