Skip to content

Commit 1a01b67

Browse files
committed
cleanup
1 parent 3737a69 commit 1a01b67

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/services/IntervalCheck.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ public class IntervalCheck {
7070
@Nullable
7171
private Scheduler scheduler;
7272

73-
@Setter
74-
private Consumer<Throwable> errorConsumer;
75-
7673
@Setter
7774
private Consumer<Throwable> retryConsumer;
7875

@@ -95,8 +92,8 @@ public void start() {
9592
.doOnSubscribe((s) -> log.debug("Scheduled {}-check every {}", this.name, this.interval))
9693
.log(log.getName(), Level.FINEST) //
9794
.subscribeOn(this.scheduler) //
98-
.flatMap((i) -> this.checkAllInstances()) // Allow concurrent check cycles
99-
// if previous is slow
95+
// Allow concurrent check cycles if previous is slow
96+
.flatMap((i) -> this.checkAllInstances(), Math.max(1, Runtime.getRuntime().availableProcessors() / 2))
10097
.retryWhen(createRetrySpec())
10198
.subscribe(null, (Throwable error) -> log.error("Unexpected error in {}-check", this.name, error));
10299
}

spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/services/IntervalCheckTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ void should_not_lose_checks_under_backpressure_latest() {
195195
@SuppressWarnings("unchecked")
196196
Function<InstanceId, Mono<Void>> slowCheckFn = mock(Function.class);
197197

198-
IntervalCheck slowCheck = new IntervalCheck("backpressure-test", slowCheckFn, CHECK_INTERVAL,
199-
Duration.ofMillis(50), Duration.ofSeconds(1));
198+
IntervalCheck slowCheck = new IntervalCheck("backpressure-test", slowCheckFn, CHECK_INTERVAL, CHECK_INTERVAL,
199+
Duration.ofSeconds(1));
200200

201201
// Add multiple instances to increase load and cause drops
202202
Set<InstanceId> instanceIds = IntStream.range(0, 50)
@@ -222,7 +222,7 @@ void should_not_lose_checks_under_backpressure_latest() {
222222
}
223223
else {
224224
// Sometimes slow
225-
return Mono.delay(CHECK_INTERVAL.plus(Duration.ofMillis(100))).then();
225+
return Mono.delay(CHECK_INTERVAL.plus(Duration.ofMillis(500))).then();
226226
}
227227
}).when(slowCheckFn).apply(any());
228228

0 commit comments

Comments
 (0)