Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grid] Set session-request-timeout as client readTimeout in RemoteNewSessionQueue #14272

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.openqa.selenium.grid.sessionqueue.remote;

import static org.openqa.selenium.remote.http.ClientConfig.defaultConfig;
import static org.openqa.selenium.remote.http.HttpMethod.DELETE;
import static org.openqa.selenium.remote.http.HttpMethod.GET;
import static org.openqa.selenium.remote.http.HttpMethod.POST;
Expand All @@ -25,6 +26,7 @@
import java.lang.reflect.Type;
import java.net.MalformedURLException;
import java.net.URI;
import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -48,6 +50,7 @@
import org.openqa.selenium.internal.Require;
import org.openqa.selenium.json.Json;
import org.openqa.selenium.json.TypeToken;
import org.openqa.selenium.remote.http.ClientConfig;
import org.openqa.selenium.remote.http.Contents;
import org.openqa.selenium.remote.http.Filter;
import org.openqa.selenium.remote.http.HttpClient;
Expand Down Expand Up @@ -77,14 +80,17 @@ public RemoteNewSessionQueue(Tracer tracer, HttpClient client, Secret registrati
public static NewSessionQueue create(Config config) {
Tracer tracer = new LoggingOptions(config).getTracer();
URI uri = new NewSessionQueueOptions(config).getSessionQueueUri();
Duration sessionRequestTimeout = new NewSessionQueueOptions(config).getSessionRequestTimeout();
HttpClient.Factory clientFactory = new NetworkOptions(config).getHttpClientFactory(tracer);

SecretOptions secretOptions = new SecretOptions(config);
Secret registrationSecret = secretOptions.getRegistrationSecret();

try {
ClientConfig clientConfig =
defaultConfig().readTimeout(sessionRequestTimeout).baseUrl(uri.toURL());
return new RemoteNewSessionQueue(
tracer, clientFactory.createClient(uri.toURL()), registrationSecret);
tracer, clientFactory.createClient(clientConfig), registrationSecret);
} catch (MalformedURLException e) {
throw new UncheckedIOException(e);
}
Expand Down
Loading