Skip to content

Commit

Permalink
Revert "spring-projectsGH-427: Fix issue with multiplierExpression be…
Browse files Browse the repository at this point in the history
…tween 0 to 1"

This reverts commit 7c478d1.
  • Loading branch information
aftabshk committed May 3, 2024
1 parent 471de0b commit 03e3794
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,7 @@ public void initialIntervalSupplier(Supplier<Long> initialIntervalSupplier) {
*/
public void multiplierSupplier(Supplier<Double> multiplierSupplier) {
Assert.notNull(multiplierSupplier, "'multiplierSupplier' cannot be null");
if (multiplierSupplier.get() > 1.0) {
this.multiplierSupplier = multiplierSupplier;
return;
}

this.multiplierSupplier = () -> 1.0;
this.multiplierSupplier = multiplierSupplier;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void runtimeExpressions() throws Exception {
verify(runtime, times(6)).getMaxAttempts();
verify(runtime, times(1)).getInitial();
verify(runtime, times(2)).getMax();
verify(runtime, times(4)).getMult();
verify(runtime, times(2)).getMult();

RetryConfiguration config = context.getBean(RetryConfiguration.class);
AnnotationAwareRetryOperationsInterceptor advice = (AnnotationAwareRetryOperationsInterceptor) new DirectFieldAccessor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,4 @@ public void sleep(long backOffPeriod) throws InterruptedException {
assertThat(Thread.interrupted()).isTrue();
}

@Test
public void testSetMultiplierSupplier() {
ExponentialBackOffPolicy strategy = new ExponentialBackOffPolicy();
strategy.multiplierSupplier(() -> 3.);
assertThat(strategy.toString()).contains("multiplier=3.");
strategy.multiplierSupplier(() -> .5);
assertThat(strategy.toString()).contains("multiplier=1.");
}

}

0 comments on commit 03e3794

Please sign in to comment.