|
17 | 17 |
|
18 | 18 | package org.openqa.selenium.grid.distributor.local; |
19 | 19 |
|
20 | | -import static com.google.common.collect.ImmutableSet.toImmutableSet; |
21 | | -import static org.openqa.selenium.grid.data.Availability.DOWN; |
22 | | -import static org.openqa.selenium.grid.data.Availability.DRAINING; |
23 | | -import static org.openqa.selenium.grid.data.Availability.UP; |
24 | | -import static org.openqa.selenium.internal.Debug.getDebugLogLevel; |
25 | | -import static org.openqa.selenium.remote.RemoteTags.CAPABILITIES; |
26 | | -import static org.openqa.selenium.remote.RemoteTags.CAPABILITIES_EVENT; |
27 | | -import static org.openqa.selenium.remote.RemoteTags.SESSION_ID; |
28 | | -import static org.openqa.selenium.remote.RemoteTags.SESSION_ID_EVENT; |
29 | | -import static org.openqa.selenium.remote.tracing.AttributeKey.SESSION_URI; |
30 | | -import static org.openqa.selenium.remote.tracing.Tags.EXCEPTION; |
31 | | - |
32 | 20 | import com.google.common.collect.ImmutableMap; |
33 | 21 | import com.google.common.collect.ImmutableSet; |
34 | 22 |
|
35 | | -import dev.failsafe.Failsafe; |
36 | | -import dev.failsafe.RetryPolicy; |
37 | | - |
38 | 23 | import org.openqa.selenium.Beta; |
39 | 24 | import org.openqa.selenium.Capabilities; |
40 | 25 | import org.openqa.selenium.HealthCheckFailedException; |
|
91 | 76 | import org.openqa.selenium.remote.tracing.Tracer; |
92 | 77 | import org.openqa.selenium.status.HasReadyState; |
93 | 78 |
|
| 79 | +import dev.failsafe.Failsafe; |
| 80 | +import dev.failsafe.RetryPolicy; |
| 81 | + |
94 | 82 | import java.io.Closeable; |
95 | 83 | import java.io.UncheckedIOException; |
96 | 84 | import java.net.URI; |
|
114 | 102 | import java.util.logging.Logger; |
115 | 103 | import java.util.stream.Collectors; |
116 | 104 |
|
| 105 | +import static com.google.common.collect.ImmutableSet.toImmutableSet; |
| 106 | +import static org.openqa.selenium.grid.data.Availability.DOWN; |
| 107 | +import static org.openqa.selenium.grid.data.Availability.DRAINING; |
| 108 | +import static org.openqa.selenium.grid.data.Availability.UP; |
| 109 | +import static org.openqa.selenium.internal.Debug.getDebugLogLevel; |
| 110 | +import static org.openqa.selenium.remote.RemoteTags.CAPABILITIES; |
| 111 | +import static org.openqa.selenium.remote.RemoteTags.CAPABILITIES_EVENT; |
| 112 | +import static org.openqa.selenium.remote.RemoteTags.SESSION_ID; |
| 113 | +import static org.openqa.selenium.remote.RemoteTags.SESSION_ID_EVENT; |
| 114 | +import static org.openqa.selenium.remote.tracing.AttributeKey.SESSION_URI; |
| 115 | +import static org.openqa.selenium.remote.tracing.Tags.EXCEPTION; |
| 116 | + |
117 | 117 | public class LocalDistributor extends Distributor implements Closeable { |
118 | 118 |
|
119 | 119 | private static final Logger LOG = Logger.getLogger(LocalDistributor.class.getName()); |
@@ -303,6 +303,11 @@ public LocalDistributor add(Node node) { |
303 | 303 | NodeStatus initialNodeStatus; |
304 | 304 | try { |
305 | 305 | initialNodeStatus = node.getStatus(); |
| 306 | + if (initialNodeStatus.getAvailability() == DRAINING) { |
| 307 | + // A Node might be draining but the heartbeat is still running. |
| 308 | + // We do not need to add this Node again. |
| 309 | + return this; |
| 310 | + } |
306 | 311 | model.add(initialNodeStatus); |
307 | 312 | nodes.put(node.getId(), node); |
308 | 313 | } catch (Exception e) { |
|
0 commit comments