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
-> 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