Closed altro3 closed 12 months ago
It did retry, but the logs are saying a 500 error was received. You need to identify cause of the remote error. The remote has some sort of issue with the request you sent.
@DeCaMil Thanks for answer! But no, I specifically told mockServer to respond with an error 500 to the request, so that the retry mechanism worked. Look again:
MockResponse response = new MockResponse();
response.setResponseCode(HttpStatus.INTERNAL_SERVER_ERROR.value());
And look what I see in the logs in the end: in the first case there are 3 requests, in the second - only one. The problem is that using exchange did not work the retry mechanism.
@altro3 sorry for the delay. Can you please move that code snippet into an actual project that we can use to run the test? That way, we'll be sure to test the same thing.
You can share the project with us by attaching a zip to this issue or by pushing the code to a separate GitHub repository. Thanks!
@snicoll Hi! Don't worry, it's only 4,5 years :-D, it could have been worse ;-). Well, I need to run this test again with the latest versions of the spring boot, because... This problem has been around for a long time and may have already been fixed. When I have free time, I'll do it
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
If you use retrieve() method all works fine:
for test you can use OkHttp MockWebServer (setup numRetries = 2 before):
In logs you can see that webClient send 3 request and next thrown IllegalStateException:
If you try use exchange() method with retryBackoff() you will see that send only 1 request:
Run same test and you will see in logs:
No retries in this case.
Is this bug or I doing something wrong?