hal 0.1.2 → 0.1.4
raw patch · 3 files changed
+33/−7 lines, 3 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
- README.md +19/−0
- hal.cabal +4/−4
- src/AWS/Lambda/RuntimeClient.hs +10/−3
README.md view
@@ -29,10 +29,24 @@ ## Table of Contents + - [Supported Platforms / GHC Versions](#supported-platforms-ghc-versions) - [Quick Start](#quick-start) - [Usage](#usage) - [Local Testing](#local-testing) +## Supported Platforms / GHC Versions++We currently support this library under the same environment that [AWS Lambda+supports][lambda-env].++Our [CI] currently targets the latest three [LTS Stackage Versions][stackage],+the latest three minor versions of [GHC] under [Cabal]+(e.g. `8.6.x`, `8.4.x`, and `8.2.x`), and GHC-head / Stackage nightly builds.++If you haven't already, adding `docker: { enable: true }` to your `stack.yaml`+file will ensure that you're building a binary that can run in+[AWS Lambda][lambda-env].+ ## Quick Start This quick start assumes you have the following tools installed:@@ -168,3 +182,8 @@ [CloudFormation]: https://aws.amazon.com/cloudformation/ [aws-sam-cli]: https://github.com/awslabs/aws-sam-cli [Rust Runtime]: https://github.com/awslabs/aws-lambda-rust-runtime+[lambda-env]: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html+[ci]: https://travis-ci.org/Nike-Inc/hal+[stackage]: https://www.stackage.org/+[GHC]: https://www.haskell.org/ghc/download.html+[Cabal]: https://www.haskell.org/cabal/download.html
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: 1408c613441045c809d9a7ee2bbf3b5ec3b31e015cde8e8339da5a1d14df1c1f+-- hash: 2c7baad228ce0a3a9be1e930b2b3f15f122b84118367a2a1efeadb22c7cbe530 name: hal-version: 0.1.2+version: 0.1.4 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@@ -38,7 +38,7 @@ Paths_hal hs-source-dirs: src- default-extensions: OverloadedStrings BangPatterns DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable DerivingStrategies EmptyCase GeneralizedNewtypeDeriving InstanceSigs LambdaCase MultiParamTypeClasses MultiWayIf OverloadedStrings PatternSynonyms ScopedTypeVariables+ default-extensions: OverloadedStrings BangPatterns DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase GeneralizedNewtypeDeriving InstanceSigs LambdaCase MultiParamTypeClasses MultiWayIf OverloadedStrings PatternSynonyms ScopedTypeVariables ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-partial-type-signatures -fno-warn-name-shadowing -fwarn-tabs -fwarn-unused-imports -fwarn-missing-signatures -fwarn-incomplete-patterns build-depends: aeson
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