`Retry` behaviour
See original GitHub issueI tried to use very wrong retry policy:
val always: (Request[IO], Either[Throwable, Response[IO]]) => Boolean = (_, _) => true
Retry[IO](RetryPolicy(RetryPolicy.exponentialBackoff(maxWait = 1.second, maxRetry = 5), always))(client)
As expected, on each successful POST call, http4s retried it, but strangely enough with extra body attached.
My call code is like:
httpClient.expect[ExpectedResponse](
Request[IO](
method = Method.POST,
uri = uri / "resource",
headers = headers,
).withEntity(payload.asJson),
)
Assuming, that payload
is {"one": 1, "other": "value"}
, in logs I after 5th retry I got:
[2021-10-26T07:15:12.460Z] [error] [DEBUG] 07:15:01 [TestKit.scala:58] HTTP/1.1 POST https://uri/resource Headers(Authorization: <REDACTED>, Content-Length: 446, Content-Type: application/json, Accept: application/json) body="{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}
Payload was attached 6 times, once in original request and 5 more times with each retry (first retry contained doubled body, next one - tripled, etc)
Is that expected behaviour?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Error handling and automatic retries in AWS Lambda
When you invoke a function, two types of error can occur. Invocation errors occur when the invocation request is rejected before your function...
Read more >Web - SDK Retry Behaviour - Bluedot documentation
Web – SDK Retry Behaviour. A key target environment is mobile browsers, which can have intermittent network connections due to poor coverage ...
Read more >How AWS Lambda Retry really works - Serverless Framework
Using Step Functions, the developer can decide the transition between states and retry behaviour (number of retries and delay duration).
Read more >Retry - Spring
Retry. To make processing more robust and less prone to failure, it sometimes helps to automatically retry a failed operation in case it ......
Read more >Retry | Kuma
The policy let you configure retry behaviour for HTTP , GRPC and TCP protocols. Example. Kubernetes; Universal. apiVersion ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please do! AFAIK no one is working on this 😃
can I give this a shot if no one has picked this up?