From e284a68a9fa14f3da9a1da04dee8b2bd8526e320 Mon Sep 17 00:00:00 2001 From: Jappie Klooster Date: Tue, 22 Mar 2022 15:18:38 -0400 Subject: [PATCH] Remove the use of masks I don't think these are neccisary. If an exception get's delivered at these points, we couldn't do anything about it anyway --- yesod-core/src/Yesod/Core/Internal/Run.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yesod-core/src/Yesod/Core/Internal/Run.hs b/yesod-core/src/Yesod/Core/Internal/Run.hs index a7530eb5..618665f2 100644 --- a/yesod-core/src/Yesod/Core/Internal/Run.hs +++ b/yesod-core/src/Yesod/Core/Internal/Run.hs @@ -96,7 +96,7 @@ basicRunHandler :: ToTypedContent c -> YesodRequest -> InternalState -> IO (GHState, HandlerContents) -basicRunHandler rhe handler yreq resState = mask $ \unmask -> do +basicRunHandler rhe handler yreq resState = do -- Create a mutable ref to hold the state. We use mutable refs so -- that the updates will survive runtime exceptions. istate <- I.newIORef defState @@ -104,7 +104,7 @@ basicRunHandler rhe handler yreq resState = mask $ \unmask -> do -- Run the handler itself, capturing any runtime exceptions and -- converting them into a @HandlerContents@ contents' <- unsafeAsyncCatch - (unmask $ do + (do res <- unHandlerFor handler (hd istate) tc <- evaluate (toTypedContent res) -- Success! Wrap it up in an @HCContent@ @@ -218,9 +218,9 @@ runHandler :: ToTypedContent c => RunHandlerEnv site site -> HandlerFor site c -> YesodApp -runHandler rhe@RunHandlerEnv {..} handler yreq = withInternalState $ \resState -> mask $ \unmask -> do +runHandler rhe@RunHandlerEnv {..} handler yreq = withInternalState $ \resState -> do -- Get the raw state and original contents - (state, contents0) <- unmask $ basicRunHandler rhe handler yreq resState + (state, contents0) <- basicRunHandler rhe handler yreq resState -- Evaluate the unfortunately-lazy session and headers, -- propagating exceptions into the contents