From a56a89b3bcd1954871aa189b26b8d60cb173df79 Mon Sep 17 00:00:00 2001 From: Nikita Tchayka Date: Tue, 26 Mar 2019 13:03:29 +0000 Subject: [PATCH 1/2] Remove timeout in invocation GET --- package.yaml | 3 ++- src/Aws/Lambda/Runtime.hs | 5 ++++- stack.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.yaml b/package.yaml index 62406a9..aba0679 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: aws-lambda-haskell-runtime -version: 1.0.9 +version: 1.0.10 github: "theam/aws-lambda-haskell-runtime" license: Apache-2.0 author: Nikita Tchayka @@ -26,6 +26,7 @@ library: - conduit - directory - filepath + - http-client - microlens-platform - optparse-generic - process diff --git a/src/Aws/Lambda/Runtime.hs b/src/Aws/Lambda/Runtime.hs index 2afb44d..5712278 100644 --- a/src/Aws/Lambda/Runtime.hs +++ b/src/Aws/Lambda/Runtime.hs @@ -20,6 +20,7 @@ import Data.Monoid ((<>)) import qualified Data.CaseInsensitive as CI import Lens.Micro.Platform hiding ((.=)) import qualified Network.Wreq as Wreq +import qualified Network.HTTP.Client as Http import qualified System.Environment as Environment import qualified System.Process as Process import qualified Data.UUID as UUID @@ -132,8 +133,10 @@ readFunctionMemory = do getApiData :: Text -> App (Wreq.Response LByteString) getApiData endpoint = - keepRetrying (Wreq.get $ nextInvocationEndpoint endpoint) + keepRetrying (Wreq.getWith opts $ nextInvocationEndpoint endpoint) where + opts = Wreq.defaults + & Wreq.manager .~ Left (Http.defaultManagerSettings { Http.managerResponseTimeout = Http.responseTimeoutNone }) keepRetrying :: IO (Wreq.Response LByteString) -> App (Wreq.Response LByteString) keepRetrying f = do result <- (liftIO $ try f) :: App (Either IOException (Wreq.Response LByteString)) diff --git a/stack.yaml b/stack.yaml index ee4aacd..498b8d3 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,7 +17,7 @@ # # resolver: ./custom-snapshot.yaml # resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: lts-12.13 +resolver: lts-13.0 # User packages to be built. # Various formats can be used as shown in the example below. From 637d41e85c005b85a848519613f0a5d2db7b9bc3 Mon Sep 17 00:00:00 2001 From: Nikita Tchayka Date: Tue, 26 Mar 2019 13:19:44 +0000 Subject: [PATCH 2/2] add nix files --- default.nix | 24 ++++++++++++++++++++++++ shell.nix | 1 + 2 files changed, 25 insertions(+) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..cfa3328 --- /dev/null +++ b/default.nix @@ -0,0 +1,24 @@ +{ compiler ? "ghc863", pkgs ? import {} }: + +let + + haskellPackages = pkgs.haskell.packages.${compiler}.extend ( self: super: { + }); + + runtime = haskellPackages.callCabal2nix "aws-lambda-haskell-runtime" ./. {}; + +in +{ + aws-lambda-haskell-runtime = runtime; + aws-lambda-haskell-runtime-shell = haskellPackages.shellFor { + packages = p: [runtime]; + buildInputs = with pkgs; [ + cabal-install + hlint + stack + haskellPackages.ghcid + haskellPackages.weeder + zlib + ]; + }; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..f3d8316 --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./. {}).aws-lambda-haskell-runtime-shell