Make awaitInitialTransfer for ISPN configurable

Closes #16671
This commit is contained in:
Martin Kanis 2023-06-16 15:51:26 +02:00 committed by Hynek Mlnařík
parent 3a3907ab15
commit db9b6c2152
2 changed files with 13 additions and 8 deletions

View file

@ -253,6 +253,7 @@ public class DefaultInfinispanConnectionProviderFactory implements InfinispanCon
int l1Lifespan = config.getInt("l1Lifespan", 600000);
boolean l1Enabled = l1Lifespan > 0;
Boolean awaitInitialTransfer = config.getBoolean("awaitInitialTransfer", true);
sessionConfigBuilder.clustering()
.hash()
.numOwners(owners)
@ -260,7 +261,7 @@ public class DefaultInfinispanConnectionProviderFactory implements InfinispanCon
.l1()
.enabled(l1Enabled)
.lifespan(l1Lifespan)
.stateTransfer().timeout(30, TimeUnit.SECONDS)
.stateTransfer().awaitInitialTransfer(awaitInitialTransfer).timeout(30, TimeUnit.SECONDS)
.build();
}

View file

@ -95,13 +95,17 @@ public class Infinispan extends KeycloakModelParameters {
@Override
public void updateConfig(Config cf) {
cf.spi("connectionsInfinispan")
.provider("default")
.config("embedded", "true")
.config("clustered", "true")
.config("useKeycloakTimeService", "true")
.config("nodeName", "node-" + NODE_COUNTER.incrementAndGet())
.spi(UserLoginFailureSpi.NAME)
Config.ProviderConfig provider = cf.spi("connectionsInfinispan").provider("default");
provider = provider.config("embedded", "true")
.config("clustered", "true")
.config("useKeycloakTimeService", "true")
.config("nodeName", "node-" + NODE_COUNTER.incrementAndGet());
String preloading = System.getProperty("keycloak.userSessions.infinispan.preloadOfflineSessionsFromDatabase");
if (preloading != null && "true".equals(preloading)) {
provider.config("awaitInitialTransfer", "false");
}
cf.spi(UserLoginFailureSpi.NAME)
.provider(InfinispanUserLoginFailureProviderFactory.PROVIDER_ID)
.config("stalledTimeoutInSeconds", "10")
.spi(UserSessionSpi.NAME)