Skip to content

Commit

Permalink
fix(#2105): Retry mechanism without delay causing failures (#2106)
Browse files Browse the repository at this point in the history
  • Loading branch information
liran2000 authored Aug 2, 2022
1 parent c28456a commit ae5c0f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void start() {
this.subscription = Flux.interval(this.interval)
.doOnSubscribe((s) -> log.debug("Scheduled {}-check every {}", this.name, this.interval))
.log(log.getName(), Level.FINEST).subscribeOn(this.scheduler).concatMap((i) -> this.checkAllInstances())
.retryWhen(Retry.indefinitely()
.retryWhen(Retry.backoff(Long.MAX_VALUE, Duration.ofSeconds(1))
.doBeforeRetry((s) -> log.warn("Unexpected error in {}-check", this.name, s.failure())))
.subscribe();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void should_check_after_error() throws InterruptedException {
when(this.checkFn.apply(any())).thenReturn(Mono.error(new RuntimeException("Test"))).thenReturn(Mono.empty());

this.intervalCheck.start();
Thread.sleep(100);
Thread.sleep(1500);
verify(this.checkFn, atLeast(2)).apply(InstanceId.of("Test"));
}

Expand Down

0 comments on commit ae5c0f8

Please sign in to comment.