hal 0.3.0 → 0.3.1
raw patch · 2 files changed
+13/−6 lines, 2 filesdep ~aesondep ~bytestringdep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, bytestring, containers, envy, exceptions, http-conduit, http-types, mtl, text, time
API changes (from Hackage documentation)
Files
- hal.cabal +3/−3
- src/AWS/Lambda/RuntimeClient.hs +10/−3
hal.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: 811e290f1780d180d8868adb2a10e2715dc938423a42a8eea7d6c73c821c7a24+-- hash: 5c6b20d6f7c9980f765b2fe4df347b6539223f3f8abaa4d30613db754514df31 name: hal-version: 0.3.0+version: 0.3.1 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
@@ -31,7 +31,7 @@ setRequestCheckStatus, setRequestHeader, setRequestMethod, setRequestPath)-import Network.HTTP.Types.Status (status413, statusIsSuccessful)+import Network.HTTP.Types.Status (status403, status413, statusIsSuccessful) import System.Environment (getEnv) -- | Lambda runtime error that we pass back to AWS@@ -110,9 +110,16 @@ 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) -> threadDelay 500 >> runtimeClientRetryTry' (i - 1) f- Right res -> return $ Right res+ 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