diff --git a/java/server/src/org/openqa/selenium/grid/distributor/config/DistributorOptions.java b/java/server/src/org/openqa/selenium/grid/distributor/config/DistributorOptions.java index efb8bc0229f55..b653248372ed7 100644 --- a/java/server/src/org/openqa/selenium/grid/distributor/config/DistributorOptions.java +++ b/java/server/src/org/openqa/selenium/grid/distributor/config/DistributorOptions.java @@ -31,7 +31,7 @@ public class DistributorOptions { - public static final int DEFAULT_HEALTHCHECK_INTERVAL = 300; + public static final int DEFAULT_HEALTHCHECK_INTERVAL = 120; public static final String DISTRIBUTOR_SECTION = "distributor"; static final String DEFAULT_DISTRIBUTOR_IMPLEMENTATION = "org.openqa.selenium.grid.distributor.local.LocalDistributor"; diff --git a/java/server/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java b/java/server/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java index 00005494db24c..af98865fa67f7 100644 --- a/java/server/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java +++ b/java/server/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java @@ -58,6 +58,7 @@ import org.openqa.selenium.grid.sessionmap.config.SessionMapOptions; import org.openqa.selenium.grid.sessionqueue.NewSessionQueue; import org.openqa.selenium.grid.sessionqueue.config.NewSessionQueueOptions; +import org.openqa.selenium.internal.Debug; import org.openqa.selenium.internal.Either; import org.openqa.selenium.internal.Require; import org.openqa.selenium.remote.SessionId; @@ -249,8 +250,6 @@ private void register(NodeStatus status) { public LocalDistributor add(Node node) { Require.nonNull("Node", node); - LOG.info(String.format("Added node %s at %s.", node.getId(), node.getUri())); - nodes.put(node.getId(), node); model.add(node.getStatus()); @@ -259,6 +258,12 @@ public LocalDistributor add(Node node) { allChecks.put(node.getId(), runnableHealthCheck); hostChecker.submit(runnableHealthCheck, healthcheckInterval, Duration.ofSeconds(30)); + LOG.info(String.format( + "Added node %s at %s. Health check every %ss", + node.getId(), + node.getUri(), + healthcheckInterval.toMillis() / 1000)); + bus.fire(new NodeAddedEvent(node.getId())); return this; @@ -268,6 +273,8 @@ private Runnable asRunnableHealthCheck(Node node) { HealthCheck healthCheck = node.getHealthCheck(); NodeId id = node.getId(); return () -> { + LOG.log(getDebugLogLevel(), "Running health check for " + node.getId()); + HealthCheck.Result result; try { result = healthCheck.check(); @@ -279,6 +286,9 @@ private Runnable asRunnableHealthCheck(Node node) { Lock writeLock = lock.writeLock(); writeLock.lock(); try { + LOG.log( + getDebugLogLevel(), + String.format("Health check result for %s was %s", node.getId(), result.getAvailability())); model.setAvailability(id, result.getAvailability()); } finally { writeLock.unlock();