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 @@ -118,7 +118,7 @@ private static FlagsmithConfig initializeConfig(FlagsmithProviderOptions options
flagsmithConfig.withLocalEvaluation(options.isLocalEvaluation());
}

if (options.getEnvironmentRefreshIntervalSeconds() > -1) {
if (options.getEnvironmentRefreshIntervalSeconds() != null) {
flagsmithConfig.withEnvironmentRefreshIntervalSeconds(options.getEnvironmentRefreshIntervalSeconds());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public class FlagsmithProviderOptions {
* Set environment refresh rate with polling manager. Only needed when local evaluation is true.
* Optional. Default: 60
*/
private int environmentRefreshIntervalSeconds = 60;
@Builder.Default
private Integer environmentRefreshIntervalSeconds = 60;

/**
* Controls whether Flag Analytics data is sent to the Flagsmith API See
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ void shouldGetMetadataAndValidateName() {
.getName());
}

@Test
void shouldDefaultEnvironmentRefreshIntervalSecondsTo60() {
FlagsmithProviderOptions options = FlagsmithProviderOptions.builder()
.apiKey("API_KEY")
.localEvaluation(true)
.build();
assertEquals(Integer.valueOf(60), options.getEnvironmentRefreshIntervalSeconds());
}

@ParameterizedTest
@MethodSource("invalidOptions")
void shouldThrowAnExceptionWhenOptionsInvalid(FlagsmithProviderOptions options) {
Expand Down