Skip to content
Merged
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
22 changes: 17 additions & 5 deletions client/src/main/java/io/split/client/SplitClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class SplitClientConfig {
private final int _onDemandFetchMaxRetries;
private final int _failedAttemptsBeforeLogging;
private final boolean _cdnDebugLogging;
private long _validateAfterInactivityInMillis;

// Proxy configs
private final HttpHost _proxy;
Expand Down Expand Up @@ -106,7 +107,8 @@ private SplitClientConfig(String endpoint,
int onDemandFetchRetryDelayMs,
int onDemandFetchMaxRetries,
int failedAttemptsBeforeLogging,
boolean cdnDebugLogging) {
boolean cdnDebugLogging,
long validateAfterInactivityInMillis) {
_endpoint = endpoint;
_eventsEndpoint = eventsEndpoint;
_featuresRefreshRate = pollForFeatureChangesEveryNSeconds;
Expand Down Expand Up @@ -143,6 +145,7 @@ private SplitClientConfig(String endpoint,
_onDemandFetchMaxRetries = onDemandFetchMaxRetries;
_failedAttemptsBeforeLogging = failedAttemptsBeforeLogging;
_cdnDebugLogging = cdnDebugLogging;
_validateAfterInactivityInMillis = validateAfterInactivityInMillis;

Properties props = new Properties();
try {
Expand Down Expand Up @@ -286,6 +289,9 @@ public int get_telemetryRefreshRate() {

public boolean cdnDebugLogging() { return _cdnDebugLogging; }

public long validateAfterInactivityInMillis() {
return _validateAfterInactivityInMillis;
}

public static final class Builder {

Expand Down Expand Up @@ -323,11 +329,12 @@ public static final class Builder {
private String _authServiceURL = AUTH_ENDPOINT;
private String _streamingServiceURL = STREAMING_ENDPOINT;
private String _telemetryURl = TELEMETRY_ENDPOINT;
private int _telemetryRefreshRate = 60;
private int _telemetryRefreshRate = 3600;
private int _onDemandFetchRetryDelayMs = 50;
private final int _onDemandFetchMaxRetries = 10;
private final int _failedAttemptsBeforeLogging = 10;
private final boolean _cdnDebugLogging = true;
private long _validateAfterInactivityInMillis = 1000;

public Builder() {
}
Expand Down Expand Up @@ -719,8 +726,7 @@ public Builder streamingServiceURL(String streamingServiceURL) {
return this;
}

/**
* Set telemetry service URL.
/** Set telemetry service URL.
* @param telemetryURL
* @return
*/
Expand Down Expand Up @@ -817,10 +823,15 @@ public SplitClientConfig build() {
if (_onDemandFetchRetryDelayMs <= 0) {
throw new IllegalStateException("streamingRetryDelay must be > 0");
}

if(_onDemandFetchMaxRetries <= 0) {
throw new IllegalStateException("_onDemandFetchMaxRetries must be > 0");
}

if(_telemetryRefreshRate <= 60) {
throw new IllegalStateException("_telemetryRefreshRate must be >= 60");
}

return new SplitClientConfig(
_endpoint,
_eventsEndpoint,
Expand Down Expand Up @@ -857,7 +868,8 @@ public SplitClientConfig build() {
_onDemandFetchRetryDelayMs,
_onDemandFetchMaxRetries,
_failedAttemptsBeforeLogging,
_cdnDebugLogging);
_cdnDebugLogging,
_validateAfterInactivityInMillis);
}
}
}
2 changes: 2 additions & 0 deletions client/src/main/java/io/split/client/SplitFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.ssl.TLS;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -258,6 +259,7 @@ private static CloseableHttpClient buildHttpClient(String apiToken, SplitClientC
.setDefaultSocketConfig(SocketConfig.custom()
.setSoTimeout(Timeout.ofMilliseconds(config.readTimeout()))
.build())
.setValidateAfterInactivity(TimeValue.ofMilliseconds(config.validateAfterInactivityInMillis()))
.build();
cm.setMaxTotal(20);
cm.setDefaultMaxPerRoute(20);
Expand Down