Skip to content

Commit 802f639

Browse files
committed
[grid] remove not reachable code
1 parent 00abc05 commit 802f639

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

Diff for: java/src/org/openqa/selenium/grid/distributor/local/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ java_library(
3131
"//java/src/org/openqa/selenium/json",
3232
"//java/src/org/openqa/selenium/remote",
3333
artifact("com.google.guava:guava"),
34-
artifact("dev.failsafe:failsafe"),
3534
],
3635
)

Diff for: java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java

+4-27
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
import com.google.common.annotations.VisibleForTesting;
3535
import com.google.common.collect.ImmutableMap;
3636
import com.google.common.collect.ImmutableSet;
37-
import dev.failsafe.Failsafe;
38-
import dev.failsafe.RetryPolicy;
3937
import java.io.Closeable;
4038
import java.io.UncheckedIOException;
4139
import java.net.URI;
@@ -375,7 +373,10 @@ public LocalDistributor add(Node node) {
375373
return this;
376374
}
377375

378-
updateNodeStatus(initialNodeStatus, healthCheck);
376+
updateNodeAvailability(
377+
initialNodeStatus.getExternalUri(),
378+
initialNodeStatus.getNodeId(),
379+
initialNodeStatus.getAvailability());
379380

380381
LOG.info(
381382
String.format(
@@ -387,30 +388,6 @@ public LocalDistributor add(Node node) {
387388
return this;
388389
}
389390

390-
private void updateNodeStatus(NodeStatus status, Runnable healthCheck) {
391-
// Setting the Node as available if the initial call to status was successful.
392-
// Otherwise, retry to have it available as soon as possible.
393-
if (status.getAvailability() == UP) {
394-
updateNodeAvailability(status.getExternalUri(), status.getNodeId(), status.getAvailability());
395-
} else {
396-
// Running the health check right after the Node registers itself. We retry the
397-
// execution because the Node might on a complex network topology. For example,
398-
// Kubernetes pods with IPs that take a while before they are reachable.
399-
RetryPolicy<Object> initialHealthCheckPolicy =
400-
RetryPolicy.builder()
401-
.withMaxAttempts(-1)
402-
.withMaxDuration(Duration.ofSeconds(90))
403-
.withDelay(Duration.ofSeconds(15))
404-
.abortIf(result -> true)
405-
.build();
406-
407-
LOG.log(getDebugLogLevel(), "Running health check for Node " + status.getExternalUri());
408-
ExecutorService executor = Executors.newSingleThreadExecutor();
409-
executor.submit(() -> Failsafe.with(initialHealthCheckPolicy).run(healthCheck::run));
410-
executor.shutdown();
411-
}
412-
}
413-
414391
private Runnable runNodeHealthChecks() {
415392
return () -> {
416393
ImmutableMap<NodeId, Runnable> nodeHealthChecks;

0 commit comments

Comments
 (0)