hal 0.3.1 → 0.3.2
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: 5c6b20d6f7c9980f765b2fe4df347b6539223f3f8abaa4d30613db754514df31+-- hash: a0d1117010a69cf876345f650da90e9f54e3fdeca036d05fdaf533cb53f43749 name: hal-version: 0.3.1+version: 0.3.2 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
@@ -106,23 +106,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