refactor(users/Profpatsch/whatcd-resolver): fix respond warning

Change-Id: Ie833b611d1ad413b03465caa38e4ee2c1deb9a37
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11644
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2024-05-11 20:19:17 +02:00 committed by clbot
parent ba1eb4dc00
commit 173e864f30

View file

@ -84,13 +84,13 @@ htmlUi = do
() ()
(Dec.fromField @Text) (Dec.fromField @Text)
withRunInIO $ \runInIO -> Warp.run 9093 $ \req respond -> do withRunInIO $ \runInIO -> Warp.run 9093 $ \req respondOrig -> do
let catchAppException act = let catchAppException act =
try act >>= \case try act >>= \case
Right a -> pure a Right a -> pure a
Left (AppException err) -> do Left (AppException err) -> do
runInIO (logError err) runInIO (logError err)
respond (Wai.responseLBS Http.status500 [] "") respondOrig (Wai.responseLBS Http.status500 [] "")
catchAppException $ do catchAppException $ do
let mp span parser = let mp span parser =
@ -233,7 +233,7 @@ htmlUi = do
(\respond -> respond.html $ (mainHtml uniqueRunId)) (\respond -> respond.html $ (mainHtml uniqueRunId))
handlers handlers
req req
respond respondOrig
where where
everySecond :: Text -> Enc -> Html -> Html everySecond :: Text -> Enc -> Html -> Html
everySecond call extraData innerHtml = [hsx|<div hx-trigger="every 1s" hx-swap="outerHTML" hx-post={call} hx-vals={Enc.encToBytesUtf8 extraData}>{innerHtml}</div>|] everySecond call extraData innerHtml = [hsx|<div hx-trigger="every 1s" hx-swap="outerHTML" hx-post={call} hx-vals={Enc.encToBytesUtf8 extraData}>{innerHtml}</div>|]