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
|
||||
healthReport' <- liftIO . readTVarIO =<< getsYesod appHealthReport
|
||||
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
|
||||
rContent <- selectRep $ do
|
||||
provideRep $
|
||||
|
||||
Loading…
Reference in New Issue
Block a user