Skip to content

Commit

Permalink
Updated test and changed expecting time to lower than 30 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
mnoman09 committed Aug 2, 2023
1 parent 7577afa commit 7ed7323
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public PollingProjectConfigManager(long period, TimeUnit timeUnit, long blocking
this.blockingTimeoutPeriod = blockingTimeoutPeriod;
this.blockingTimeoutUnit = blockingTimeoutUnit;
this.notificationCenter = notificationCenter;
if (TimeUnit.MILLISECONDS.convert(period, this.timeUnit) < 30) {
if (TimeUnit.SECONDS.convert(period, this.timeUnit) < 30) {
logger.warn("Polling intervals below 30 seconds are not recommended.");
}
final ThreadFactory threadFactory = Executors.defaultThreadFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ public void testUpdateConfigNotificationGetsTriggered() throws InterruptedExcept

@Test
public void testSettingUpLowerPollingPeriodResultsInWarning() throws InterruptedException {
long pollingPeriod = 29;
new TestProjectConfigManager(projectConfig, pollingPeriod, TimeUnit.SECONDS, pollingPeriod / 2, TimeUnit.SECONDS, new NotificationCenter());
logbackVerifier.expectMessage(Level.WARN, "Polling intervals below 30 seconds are not recommended.");
}

Expand Down Expand Up @@ -271,7 +273,11 @@ private TestProjectConfigManager(ProjectConfig projectConfig) {
}

private TestProjectConfigManager(ProjectConfig projectConfig, long blockPeriod, NotificationCenter notificationCenter) {
super(POLLING_PERIOD, POLLING_UNIT, blockPeriod, POLLING_UNIT, notificationCenter);
this(projectConfig, POLLING_PERIOD, POLLING_UNIT, blockPeriod, POLLING_UNIT, notificationCenter);
}

private TestProjectConfigManager(ProjectConfig projectConfig, long pollingPeriod, TimeUnit pollingUnit, long blockPeriod, TimeUnit blockingUnit, NotificationCenter notificationCenter) {
super(pollingPeriod, pollingUnit, blockPeriod, blockingUnit, notificationCenter);
this.projectConfig = projectConfig;
}

Expand Down

0 comments on commit 7ed7323

Please sign in to comment.