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
This commit is contained in:
Jappie Klooster 2022-03-22 15:18:38 -04:00
parent 4c1719cb6e
commit e284a68a9f

View File

@ -96,7 +96,7 @@ basicRunHandler :: ToTypedContent c
-> YesodRequest -> YesodRequest
-> InternalState -> InternalState
-> IO (GHState, HandlerContents) -> 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 -- Create a mutable ref to hold the state. We use mutable refs so
-- that the updates will survive runtime exceptions. -- that the updates will survive runtime exceptions.
istate <- I.newIORef defState 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 -- Run the handler itself, capturing any runtime exceptions and
-- converting them into a @HandlerContents@ -- converting them into a @HandlerContents@
contents' <- unsafeAsyncCatch contents' <- unsafeAsyncCatch
(unmask $ do (do
res <- unHandlerFor handler (hd istate) res <- unHandlerFor handler (hd istate)
tc <- evaluate (toTypedContent res) tc <- evaluate (toTypedContent res)
-- Success! Wrap it up in an @HCContent@ -- Success! Wrap it up in an @HCContent@
@ -218,9 +218,9 @@ runHandler :: ToTypedContent c
=> RunHandlerEnv site site => RunHandlerEnv site site
-> HandlerFor site c -> HandlerFor site c
-> YesodApp -> 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 -- 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, -- Evaluate the unfortunately-lazy session and headers,
-- propagating exceptions into the contents -- propagating exceptions into the contents