Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data RetriesExhausted = RetriesExhausted {
- reLimit :: Int
- reResponse :: Response ()
- rateLimited :: MonadIO m => (Request -> m (Response body)) -> Request -> m (Response body)
- rateLimited' :: MonadIO m => Int -> (Request -> m (Response body)) -> Request -> m (Response body)
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.
RetriesExhausted | |
|
Instances
Exception RetriesExhausted Source # | |
Defined in Freckle.App.Http.Retry | |
Show RetriesExhausted Source # | |
Defined in Freckle.App.Http.Retry showsPrec :: Int -> RetriesExhausted -> ShowS # show :: RetriesExhausted -> String # showList :: [RetriesExhausted] -> ShowS # |
rateLimited' :: MonadIO m => Int -> (Request -> m (Response body)) -> Request -> m (Response body) Source #
rateLimited
but with configurable retry limit