mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-10 17:29:17 +00:00
Fix potentially loses precision and jitter is not well capped with unit tests
Signed-off-by: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com>
This commit is contained in:
committed by
Juergen Hoeller
parent
eeedeb3b10
commit
009b880e92
+4
-1
@@ -136,7 +136,10 @@ public abstract class AbstractRetryInterceptor implements MethodInterceptor {
|
||||
|
||||
Publisher<?> publisher = adapter.toPublisher(result);
|
||||
Retry retry = Retry.backoff(spec.maxAttempts(), spec.delay())
|
||||
.jitter((double) spec.jitter().toMillis() / spec.delay().toMillis())
|
||||
.jitter(
|
||||
spec.delay().isZero() ? 0.0 :
|
||||
Math.max(0.0, Math.min(1.0, spec.jitter().toNanos() / (double) spec.delay().toNanos()))
|
||||
)
|
||||
.multiplier(spec.multiplier())
|
||||
.maxBackoff(spec.maxDelay())
|
||||
.filter(spec.combinedPredicate().forMethod(method));
|
||||
|
||||
Reference in New Issue
Block a user