on master help sign in
Retry on response and connection timeouts by default
commit7f2b8e387ea29201f3bea88408d50b521b04d424 authorMark Karpov <markkarpov92@gmail.com> dateTue 24 Nov 2020, 14:59 (6 years ago) parent9295dc8
2 files changed+16−2
CHANGELOG.md+5 Network/HTTP/Req.hs+11−2
CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+## Req 3.8.0
2+
3+* Adjusted the value of the `httpConfigRetryJudgeException` field of
4+ `defaultHttpConfig` to retry on response timeouts and connection timeouts.
5+
16## Req 3.7.0
27
38* Added `reqCb`, a function that allows you to modify the `Request` object
Network/HTTP/Req.hs+11−2
@@ -716,7 +716,9 @@ data HttpConfig = HttpConfig
716716 -- @since 0.3.0
717717 httpConfigRetryJudge :: forall b. RetryStatus -> L.Response b -> Bool,
718718 -- | Similar to 'httpConfigRetryJudge', but is used to decide when to
719− -- retry requests that resulted in an exception.
719+ -- retry requests that resulted in an exception. By default it retries
720+ -- on response timeout and connection timeout (changed in version
721+ -- /3.8.0/).
720722 --
721723 -- @since 3.4.0
722724 httpConfigRetryJudgeException :: RetryStatus -> SomeException -> Bool,
@@ -750,7 +752,14 @@ defaultHttpConfig =
750752 598, -- (Informal convention) Network read timeout error
751753 599 -- (Informal convention) Network connect timeout error
752754 ],
753− httpConfigRetryJudgeException = \_ _ -> False,
755+ httpConfigRetryJudgeException = \_ e ->
756+ case fromException e of
757+ Just (L.HttpExceptionRequest _ c) ->
758+ case c of
759+ L.ResponseTimeout -> True
760+ L.ConnectionTimeout -> True
761+ _ -> False
762+ _ -> False,
754763 httpConfigBodyPreviewLength = 1024
755764 }
756765 where