fix(core): correct retry semantics for consumer maxAttempts configuration#3186
Open
vishwasio wants to merge 1 commit intospring-cloud:mainfrom
Open
fix(core): correct retry semantics for consumer maxAttempts configuration#3186vishwasio wants to merge 1 commit intospring-cloud:mainfrom
vishwasio wants to merge 1 commit intospring-cloud:mainfrom
Conversation
…tion The retry policy previously used maxRetries(properties.getMaxAttempts()), which caused an off-by-one error because maxRetries represents the number of retries while maxAttempts represents total delivery attempts. Example: maxAttempts=2 resulted in 3 executions (1 initial + 2 retries). This change converts maxAttempts to retries by using: maxRetries = maxAttempts - 1 A test (MaxAttemptsRetryTests) has been added to reproduce and verify the correct behavior. Signed-off-by: vishwasio <im.vishwas.03@gmail.com>
f98127f to
fe95a0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix off-by-one retry behavior for
maxAttemptsconfiguration.Currently the retry policy is configured as:
maxRetries(properties.getMaxAttempts())
However
maxRetriesrepresents the number of retries, whilemaxAttemptsrepresents the total number of delivery attempts.Example:
maxAttempts = 2
Expected behavior:
2 executions (1 initial + 1 retry)
Actual behavior:
3 executions (1 initial + 2 retries)
This PR corrects the calculation by converting attempts to retries:
maxRetries = maxAttempts - 1
A test (
MaxAttemptsRetryTests) has been added to reproduce and verifythe correct behavior.
Fixes #3183
Thanks for reviewing this contribution.