Skip to content

Commit

Permalink
Avoid reuseConnections config to be set twice in DefaultHttpClientFac…
Browse files Browse the repository at this point in the history
…tory by removing duplicate code (keycloak#36489)

Closes keycloak#36498

Signed-off-by: Johannes Knutsen <[email protected]>
  • Loading branch information
knutz3n authored Jan 16, 2025
1 parent c96f908 commit 1dd7cf0
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ private void lazyInit(KeycloakSession session) {
int maxPooledPerRoute = config.getInt("max-pooled-per-route", 64);
int connectionPoolSize = config.getInt("connection-pool-size", 128);
long connectionTTL = config.getLong("connection-ttl-millis", -1L);
boolean reuseConnections = config.getBoolean("reuse-connections", true);
long maxConnectionIdleTime = config.getLong("max-connection-idle-time-millis", 900000L);
boolean disableCookies = config.getBoolean("disable-cookies", true);
String clientKeystore = config.get("client-keystore");
Expand All @@ -185,7 +184,7 @@ private void lazyInit(KeycloakSession session) {
boolean disableTrustManager = config.getBoolean("disable-trust-manager", false);

boolean expectContinueEnabled = getBooleanConfigWithSysPropFallback("expect-continue-enabled", false);
boolean resuseConnections = getBooleanConfigWithSysPropFallback("reuse-connections", true);
boolean reuseConnections = getBooleanConfigWithSysPropFallback("reuse-connections", true);

// optionally configure proxy mappings
// direct SPI config (e.g. via standalone.xml) takes precedence over env vars
Expand All @@ -209,13 +208,12 @@ private void lazyInit(KeycloakSession session) {
.establishConnectionTimeout(establishConnectionTimeout, TimeUnit.MILLISECONDS)
.maxPooledPerRoute(maxPooledPerRoute)
.connectionPoolSize(connectionPoolSize)
.reuseConnections(reuseConnections)
.connectionTTL(connectionTTL, TimeUnit.MILLISECONDS)
.maxConnectionIdleTime(maxConnectionIdleTime, TimeUnit.MILLISECONDS)
.disableCookies(disableCookies)
.proxyMappings(proxyMappings)
.expectContinueEnabled(expectContinueEnabled)
.reuseConnections(resuseConnections);
.reuseConnections(reuseConnections);

TruststoreProvider truststoreProvider = session.getProvider(TruststoreProvider.class);
boolean disableTruststoreProvider = truststoreProvider == null || truststoreProvider.getTruststore() == null;
Expand Down

0 comments on commit 1dd7cf0

Please sign in to comment.