Skip to content

Commit a5fea38

Browse files
committed
make init blocking on load config
1 parent 794bb44 commit a5fea38

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/main/java/cloud/eppo/EppoClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ public EppoClient buildAndInit() {
197197
pollingIntervalMs,
198198
pollingIntervalMs / DEFAULT_JITTER_INTERVAL_RATIO);
199199

200+
fetchConfigurationsTask.scheduleNext();
201+
200202
// Kick off the first fetch, respecting graceful mode.
201203
try {
202-
fetchConfigurationsTask.run();
204+
instance.loadConfiguration();
203205
} catch (RuntimeException e) {
204206
log.error("Encountered Exception while loading configuration", e);
205207
if (!isGracefulMode) {

src/main/java/cloud/eppo/FetchConfigurationsTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public void run() {
2828
} catch (Exception e) {
2929
log.error("[Eppo SDK] Error fetching experiment configuration", e);
3030
}
31+
scheduleNext();
32+
}
33+
34+
public void scheduleNext() {
3135

3236
long delay = this.intervalInMillis - (long) (Math.random() * this.jitterInMillis);
3337
FetchConfigurationsTask nextTask =

src/test/java/cloud/eppo/EppoClientTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static cloud.eppo.helpers.AssignmentTestCase.runTestCase;
55
import static cloud.eppo.helpers.BanditTestCase.parseBanditTestCaseFile;
66
import static cloud.eppo.helpers.BanditTestCase.runBanditTestCase;
7-
import static cloud.eppo.helpers.TestUtils.mockHttpError;
87
import static org.junit.jupiter.api.Assertions.*;
98
import static org.junit.jupiter.api.Assertions.assertThrows;
109
import static org.mockito.Mockito.*;

0 commit comments

Comments
 (0)