-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Retryable annotation retrying with ExponentialBackOff instead of ExponentialRandomBackOff when randomExpression provided #427
Comments
您好,我已经收到您的邮件,将尽快给您回复。
|
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
Apr 27, 2024
…n and randomExpressions
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 3, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 3, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 3, 2024
…tween 0 to 1" This reverts commit 7c478d1.
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 3, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 9, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 10, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 10, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 10, 2024
aftabshk
added a commit
to aftabshk/spring-retry
that referenced
this issue
May 10, 2024
natedanner
pushed a commit
to natedanner/spring-projects__spring-retry
that referenced
this issue
May 20, 2024
Fixes: spring-projects#427 No randomness with configuration like: ``` @retryable(retryFor = {RuntimeException.class}, maxAttemptsExpression = "${retry.max-attempts}", backoff = @backoff(delayExpression = "${retry.delay}", multiplierExpression = "${retry.multiplier}", randomExpression = "${retry.random}")) ``` The random logic in the `AnnotationAwareRetryOperationsInterceptor` if `multiplierExpression` is for runtime evaluation. * Fix `AnnotationAwareRetryOperationsInterceptor` to check for `if (multiplier > 0 || parsedMultExp != null) {` before evaluating `random` * Fix `@BackOff(randomExpression)` Javadoc to indicate that it is always evaluated on configuration phase.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using following versions:
Java - 17
Spring Retry - 2.0.5
Spring Boot - 3.2.5
Example code to reproduce issue: spring-retry-issue
When I am using the @retryable annotation like following on any method:
@Retryable(retryFor = {RuntimeException.class}, maxAttempts = 10, backoff = @Backoff(delay = 2000, multiplier = 2, random = true))
Everything works as expected. I get 10 retries exponentially, increasing and with randomness in time. But, when I use the exact same values but pass them via application.properties as follows:
@Retryable(retryFor = {RuntimeException.class}, maxAttemptsExpression = "${retry.max-attempts}", backoff = @Backoff(delayExpression = "${retry.delay}", multiplierExpression = "${retry.multiplier}", randomExpression = "${retry.random}"))
Then I get 10 retries but only exponentially increasing and no randomness in time
You can see the example code here: spring-retry-issue
I have identified the issue in the code of the spring-retry library and raised a corresponding Pull Request for the same.
Here it is: Pull request 428
Please have a look and let me know if this works.
The text was updated successfully, but these errors were encountered: