hal 0.4.2 → 0.4.3
raw patch · 2 files changed
+20/−17 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hal.cabal +2/−2
- src/AWS/Lambda/RuntimeClient.hs +18/−15
hal.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 789cfae834b1d0da77c93653f25855ac1f79b2443d5fdeaf2f300037c3348ccb+-- hash: 076bfc1eca4e774099d305583e11d8f5253e39b53ace8f17b0a10c55836700c8 name: hal-version: 0.4.2+version: 0.4.3 synopsis: A runtime environment for Haskell applications running on AWS Lambda. description: This library uniquely supports different types of AWS Lambda Handlers for your needs/comfort with advanced Haskell. Instead of exposing a single function
src/AWS/Lambda/RuntimeClient.hs view
@@ -108,23 +108,26 @@ -- Retry Helpers -runtimeClientRetryTry' :: Int -> IO (Response a) -> IO (Either HttpException (Response a))-runtimeClientRetryTry' 1 f = try f-runtimeClientRetryTry' i f = do- resOrEx <- try f- let retry = threadDelay 500 >> runtimeClientRetryTry' (i - 1) f- case resOrEx of- Left (_ :: HttpException) -> retry- Right res ->- -- TODO: Explore this further.- -- Before ~July 22nd 2020 it seemed that if a next event request reached- -- the runtime before a new event was available that there would be a- -- network error. After it appears that a 403 is returned.- if getResponseStatus res == status403 then retry- else return $ Right res+runtimeClientRetryTry' :: Int -> Int -> IO (Response a) -> IO (Either HttpException (Response a))+runtimeClientRetryTry' retries maxRetries f+ | retries == maxRetries = try f+ | otherwise = do+ resOrEx <- try f+ let retry =+ threadDelay (500 * 2 ^ retries)+ >> runtimeClientRetryTry' (retries + 1) maxRetries f+ case resOrEx of+ Left (_ :: HttpException) -> retry+ Right res ->+ -- TODO: Explore this further.+ -- Before ~July 22nd 2020 it seemed that if a next event request reached+ -- the runtime before a new event was available that there would be a+ -- network error. After it appears that a 403 is returned.+ if getResponseStatus res == status403 then retry+ else return $ Right res runtimeClientRetryTry :: IO (Response a) -> IO (Either HttpException (Response a))-runtimeClientRetryTry = runtimeClientRetryTry' 3+runtimeClientRetryTry = runtimeClientRetryTry' 0 10 runtimeClientRetry :: IO (Response a) -> IO (Response a) runtimeClientRetry = fmap (either throw id) . runtimeClientRetryTry