spring-cloud / spring-cloud/spring-cloud-gateway
Document setting specific series to null with status codes in retry filter.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Describe the bug
In our production we want to use retry filter for some of our routes. We need to retry for specific statuses 502 or 503 for example. And if we have in response a status that we didn't specify from 5xx series (like 500), it will retry anyway. This is because 5xx series is default in RetryConfig:
private List<Series> series = toList(Series.SERVER_ERROR);
And because if the code is not retryable code the factory tries series:
if (!retryableStatusCode && statusCode != null) {
retryableStatusCode = retryConfig.getSeries().stream()
.anyMatch(series -> statusCode.series().equals(series));
}
Moreover, if we specified 400 code (for example) in Retry config the filter will also retry on 5xx codes.
I found a solution by specifing series value as null, but it looks like duct tape and temporary solution.
Sample
Here is the sample repository
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RetryConfig and the retry filter logic shown in the issue, then reproduce the behavior using the linked sample repository with explicit status codes and series. Done means configuring specific codes such as 502 or 503 no longer causes retries for unspecified 5xx responses, while the requested codes still retry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100