freckle-app-1.8.0.0: Haskell application toolkit used at Freckle
Safe HaskellSafe-Inferred
LanguageHaskell2010

Freckle.App.Http.Retry

Synopsis

Documentation

data RetriesExhausted Source #

Thrown if we exhaust our retries limit and still see a 429

This typically means the API is not sending back accurate Retry-In values with 429 responses.

Rationale:

In order for rateLimited to function in the case when the Request is using throwErrorStatusCodes for checkResponse, we have to modify it to not throw on 429s specifically. Otherwise, the first response would just throw due to 4XX and never retry. However, in that case of someone expecting invalid statuses to throw an exception, if we exhaust our retries and still see a 429 at the end, an exception should be thrown.

Unfortunately, it's not possible to reuse the user-defined checkResponse in order to throw a uniform HttpException in this case; so we throw this ourselves instead.

Constructors

RetriesExhausted 

Fields

rateLimited :: MonadIO m => (Request -> m (Response body)) -> Request -> m (Response body) Source #

rateLimited' :: MonadIO m => Int -> (Request -> m (Response body)) -> Request -> m (Response body) Source #

rateLimited but with configurable retry limit