Skip to content

Commit

Permalink
[grid] Grid is ready when Nodes are available
Browse files Browse the repository at this point in the history
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
  • Loading branch information
diemol committed Mar 18, 2021
1 parent a2d04d0 commit 9749b35
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toList;
import static org.openqa.selenium.grid.data.Availability.UP;
import static org.openqa.selenium.remote.http.Contents.asJson;
import static org.openqa.selenium.remote.tracing.HttpTracing.newSpanAsChildOf;
import static org.openqa.selenium.remote.tracing.Tags.EXCEPTION;
Expand Down Expand Up @@ -120,7 +121,9 @@ public HttpResponse execute(HttpRequest req) {
return response;
}

boolean ready = status.hasCapacity();
boolean ready = status.getNodes()
.stream()
.anyMatch(nodeStatus -> UP.equals(nodeStatus.getAvailability()));

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

0 comments on commit 9749b35

Please sign in to comment.