Skip to content

Commit 9749b35

Browse files
committed
[grid] Grid is ready when Nodes are available
The Grid status endpoint was returning false when all slots in all Nodes were used. This was accurate and it could tell users to wait until more new session requests are sent. However, we have the session queue now, and even if all slots in all Nodes are used, the Grid can still receive new session requests and queue them. After this change, the Grid status will return true when the Grid has one or more available Nodes. Fixes SeleniumHQ/docker-selenium#1167
1 parent a2d04d0 commit 9749b35

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

java/server/src/org/openqa/selenium/grid/router/GridStatusHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import static java.util.concurrent.TimeUnit.SECONDS;
4444
import static java.util.stream.Collectors.toList;
45+
import static org.openqa.selenium.grid.data.Availability.UP;
4546
import static org.openqa.selenium.remote.http.Contents.asJson;
4647
import static org.openqa.selenium.remote.tracing.HttpTracing.newSpanAsChildOf;
4748
import static org.openqa.selenium.remote.tracing.Tags.EXCEPTION;
@@ -120,7 +121,9 @@ public HttpResponse execute(HttpRequest req) {
120121
return response;
121122
}
122123

123-
boolean ready = status.hasCapacity();
124+
boolean ready = status.getNodes()
125+
.stream()
126+
.anyMatch(nodeStatus -> UP.equals(nodeStatus.getAvailability()));
124127

125128
List<Map<String, Object>> nodeResults = status.getNodes().stream()
126129
.map(node -> new ImmutableMap.Builder<String, Object>()

0 commit comments

Comments
 (0)