Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public class NotifierConfig {
RemindingNotifier notifier = new RemindingNotifier(
filteringNotifier, repository);
notifier.setReminderPeriod(Duration.ofMinutes(10));
notifier.setCheckReminderInverval(Duration.ofSeconds(10));
notifier.setCheckReminderInterval(Duration.ofSeconds(10));
return notifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class NotifierConfiguration {
public RemindingNotifier remindingNotifier() {
RemindingNotifier notifier = new RemindingNotifier(notifier, repository);
notifier.setReminderPeriod(Duration.ofMinutes(10)); // (1)
notifier.setCheckReminderInverval(Duration.ofSeconds(10)); //(2)
notifier.setCheckReminderInterval(Duration.ofSeconds(10)); //(2)
return notifier;
}
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public class NotifierConfig {
public RemindingNotifier remindingNotifier() { // (2)
RemindingNotifier notifier = new RemindingNotifier(filteringNotifier(), this.repository);
notifier.setReminderPeriod(Duration.ofMinutes(10));
notifier.setCheckReminderInverval(Duration.ofSeconds(10));
notifier.setCheckReminderInterval(Duration.ofSeconds(10));
return notifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public class NotifierConfig {
filteringNotifier(), repository
);
notifier.setReminderPeriod(Duration.ofMinutes(10));
notifier.setCheckReminderInverval(Duration.ofSeconds(10));
notifier.setCheckReminderInterval(Duration.ofSeconds(10));
return notifier;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public RemindingNotifier remindingNotifier(Notifier delegate,
InstanceRepository repository) {
RemindingNotifier notifier = new RemindingNotifier(delegate, repository);
notifier.setReminderPeriod(Duration.ofMinutes(10));
notifier.setCheckReminderInverval(Duration.ofSeconds(60));
notifier.setCheckReminderInterval(Duration.ofSeconds(60));
return notifier;
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public FilteringNotifier filteringNotifier() { // <1>
public RemindingNotifier remindingNotifier() { // <2>
RemindingNotifier notifier = new RemindingNotifier(filteringNotifier(), this.repository);
notifier.setReminderPeriod(Duration.ofMinutes(10));
notifier.setCheckReminderInverval(Duration.ofSeconds(10));
notifier.setCheckReminderInterval(Duration.ofSeconds(10));
return notifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class RemindingNotifier extends AbstractEventNotifier {

private final Notifier delegate;

private Duration checkReminderInverval = Duration.ofSeconds(10);
private Duration checkReminderInterval = Duration.ofSeconds(10);

private Duration reminderPeriod = Duration.ofMinutes(10);

Expand Down Expand Up @@ -83,7 +83,7 @@ else if (shouldStartReminder(event)) {

public void start() {
this.reminderScheduler = Schedulers.newSingle("reminders");
this.subscription = Flux.interval(this.checkReminderInverval, this.reminderScheduler)
this.subscription = Flux.interval(this.checkReminderInterval, this.reminderScheduler)
.log(log.getName(), Level.FINEST)
.doOnSubscribe((s) -> log.debug("Started reminders"))
.flatMap((i) -> this.sendReminders())
Expand Down Expand Up @@ -141,8 +141,22 @@ public void setReminderStatuses(String[] reminderStatuses) {
this.reminderStatuses = copy;
}

public void setCheckReminderInverval(Duration checkReminderInverval) {
this.checkReminderInverval = checkReminderInverval;
/**
* Set the interval used to check for reminders.
* @param checkReminderInterval the interval used to check for reminders
*/
public void setCheckReminderInterval(Duration checkReminderInterval) {
this.checkReminderInterval = checkReminderInterval;
}

/**
* Set the interval used to check for reminders.
* @param checkReminderInterval the interval used to check for reminders
* @deprecated use {@link #setCheckReminderInterval(Duration)} instead.
*/
@Deprecated
public void setCheckReminderInverval(Duration checkReminderInterval) {
setCheckReminderInterval(checkReminderInterval);
}

protected static final class Reminder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void should_resubscribe_after_error() {

RemindingNotifier reminder = new RemindingNotifier(notifier, this.repository);
eventPublisher.flux().flatMap(reminder::notify).subscribe();
reminder.setCheckReminderInverval(Duration.ofMillis(10));
reminder.setCheckReminderInterval(Duration.ofMillis(10));
reminder.setReminderPeriod(Duration.ofMillis(10));
reminder.start();
});
Expand All @@ -175,4 +175,31 @@ void should_resubscribe_after_error() {
.verify();
}

@SuppressWarnings("deprecation")
@Test
void should_support_deprecated_check_reminder_inverval_setter() {
TestPublisher<InstanceEvent> eventPublisher = TestPublisher.create();

Flux<InstanceEvent> emittedNotifications = Flux.create((emitter) -> {
Notifier notifier = (event) -> {
emitter.next(event);
return Mono.empty();
};

RemindingNotifier reminder = new RemindingNotifier(notifier, this.repository);
eventPublisher.flux().flatMap(reminder::notify).subscribe();

reminder.setCheckReminderInverval(Duration.ofMillis(10));
reminder.setReminderPeriod(Duration.ofMillis(10));
reminder.start();
});

StepVerifier.create(emittedNotifications)
.expectSubscription()
.then(() -> eventPublisher.next(appDown))
.expectNext(appDown, appDown)
.thenCancel()
.verify();
}

}