Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a different connectTimeout for HealthManager #460

Merged
merged 3 commits into from
Feb 21, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class RuntimeServerConfiguration {
private int accessLogAdvancedBodySize = 1_000; // bytes
private String userRealmClassname;
private int healthProbePeriod = 0;
private int healthConnectTimeout = 5_000;
private int dynamicCertificatesManagerPeriod = 0;
private int keyPairsSize = DEFAULT_KEYPAIRS_SIZE;
private Set<String> domainsCheckerIPAddresses;
Expand Down Expand Up @@ -209,6 +210,12 @@ public void configure(ConfigurationStore properties) throws ConfigurationNotVali
LOG.warning("BACKEND-HEALTH-MANAGER DISABLED");
}

healthConnectTimeout = properties.getInt("healthmanager.connecttimeout", healthConnectTimeout);
LOG.log(Level.INFO, "healthmanager.connecttimeout={0}", healthConnectTimeout);
if (healthConnectTimeout < 0) {
throw new ConfigurationNotValidException("Invalid value '" + this.healthConnectTimeout + "' for healthmanager.connecttimeout. ConnectTimeout cannot be negative");
}

dynamicCertificatesManagerPeriod = properties.getInt("dynamiccertificatesmanager.period", 0);
LOG.log(Level.INFO, "dynamiccertificatesmanager.period={0}", dynamicCertificatesManagerPeriod);
keyPairsSize = properties.getInt("dynamiccertificatesmanager.keypairssize", DEFAULT_KEYPAIRS_SIZE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public BackendHealthManager(RuntimeServerConfiguration conf, EndpointMapper mapp

// will be overridden before start
this.period = DEFAULT_PERIOD;
this.connectTimeout = conf.getConnectTimeout();
this.connectTimeout = conf.getHealthConnectTimeout();

}

Expand Down Expand Up @@ -122,8 +122,8 @@ public synchronized void reloadConfiguration(RuntimeServerConfiguration newConfi
LOG.info("Applying health probe period " + period + " s");
}

if (this.connectTimeout != newConfiguration.getConnectTimeout()) {
this.connectTimeout = newConfiguration.getConnectTimeout();
if (this.connectTimeout != newConfiguration.getHealthConnectTimeout()) {
this.connectTimeout = newConfiguration.getHealthConnectTimeout();
LOG.info("Applying new connect timeout " + this.connectTimeout + " ms");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public void testChangeBackendHealthManagerConfiguration() throws Exception {

{
Properties configuration = new Properties();
configuration.put("connectionsmanager.connecttimeout", "9479");
configuration.put("healthmanager.connecttimeout", "9479");
server.configureAtBoot(new PropertiesConfigurationStore(configuration));
}
server.start();
Expand All @@ -386,7 +386,7 @@ public void testChangeBackendHealthManagerConfiguration() throws Exception {
// change configuration
{
Properties configuration = new Properties();
configuration.put("connectionsmanager.connecttimeout", "9233");
configuration.put("healthmanager.connecttimeout", "9233");
reloadConfiguration(configuration, server);

assertEquals(9233, server.getBackendHealthManager().getConnectTimeout());
Expand Down
Loading