Do one atomic update to the cookie jar for all request and responses.

This commit is contained in:
Michael Dunn 2019-01-26 22:13:32 -06:00
parent c33f27de04
commit 8490ccbe93

View file

@ -185,7 +185,8 @@ performRequest req = do
now <- getCurrentTime
bss <- Client.brConsume $ Client.responseBody fRes
let fRes' = fRes { Client.responseBody = BSL.fromChunks bss }
mapM_ (atomically . updateCookieJar now) $ Client.hrRedirects responses <> [(fReq, fRes')]
allResponses = Client.hrRedirects responses <> [(fReq, fRes')]
atomically $ mapM_ (updateCookieJar now) allResponses
return fRes'
where
updateCookieJar :: UTCTime -> (Client.Request, Client.Response BSL.ByteString) -> STM ()