From 06e064b0bc1359ba0f9a41807a12913b390cfb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Fri, 15 Nov 2024 22:13:59 +0100 Subject: [PATCH 1/2] [grid] delay the newsessionqueue response --- .../openqa/selenium/grid/commands/Hub.java | 1 + .../selenium/grid/commands/Standalone.java | 1 + .../config/NewSessionQueueOptions.java | 10 ++++ .../local/LocalNewSessionQueue.java | 55 ++++++++++++++++--- .../grid/distributor/AddingNodesTest.java | 1 + .../distributor/DistributorDrainingTest.java | 4 ++ .../DistributorNodeAvailabilityTest.java | 5 ++ .../grid/distributor/DistributorTest.java | 4 ++ .../grid/distributor/DistributorTestBase.java | 1 + .../distributor/SessionSchedulingTest.java | 4 ++ .../local/LocalDistributorTest.java | 7 +++ .../grid/graphql/GraphqlHandlerTest.java | 1 + .../openqa/selenium/grid/router/JmxTest.java | 2 + .../grid/router/NewSessionCreationTest.java | 3 + .../selenium/grid/router/RouterTest.java | 1 + .../grid/router/SessionCleanUpTest.java | 2 + .../grid/router/SessionQueueGridTest.java | 1 + .../SessionQueueGridWithTimeoutTest.java | 1 + .../local/LocalNewSessionQueueTest.java | 2 + 19 files changed, 99 insertions(+), 7 deletions(-) diff --git a/java/src/org/openqa/selenium/grid/commands/Hub.java b/java/src/org/openqa/selenium/grid/commands/Hub.java index fd1807e8333ea..22cf38460bd5e 100644 --- a/java/src/org/openqa/selenium/grid/commands/Hub.java +++ b/java/src/org/openqa/selenium/grid/commands/Hub.java @@ -144,6 +144,7 @@ protected Handlers createHandlers(Config config) { distributorOptions.getSlotMatcher(), newSessionRequestOptions.getSessionRequestTimeoutPeriod(), newSessionRequestOptions.getSessionRequestTimeout(), + newSessionRequestOptions.getMaximumResponseDelay(), secret, newSessionRequestOptions.getBatchSize()); handler.addHandler(queue); diff --git a/java/src/org/openqa/selenium/grid/commands/Standalone.java b/java/src/org/openqa/selenium/grid/commands/Standalone.java index c12ec74ccf3ed..20fa9660784aa 100644 --- a/java/src/org/openqa/selenium/grid/commands/Standalone.java +++ b/java/src/org/openqa/selenium/grid/commands/Standalone.java @@ -150,6 +150,7 @@ protected Handlers createHandlers(Config config) { distributorOptions.getSlotMatcher(), newSessionRequestOptions.getSessionRequestTimeoutPeriod(), newSessionRequestOptions.getSessionRequestTimeout(), + newSessionRequestOptions.getMaximumResponseDelay(), registrationSecret, newSessionRequestOptions.getBatchSize()); combinedHandler.addHandler(queue); diff --git a/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java b/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java index bc9b213a35b68..1e157623879cc 100644 --- a/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java +++ b/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java @@ -35,6 +35,7 @@ public class NewSessionQueueOptions { static final String SESSION_QUEUE_SECTION = "sessionqueue"; + static final int MAXIMUM_RESPONSE_DELAY = 8; static final int DEFAULT_REQUEST_TIMEOUT = 300; static final int DEFAULT_REQUEST_TIMEOUT_PERIOD = 10; static final int DEFAULT_RETRY_INTERVAL = 15; @@ -89,6 +90,15 @@ public URI getSessionQueueUri() { } } + public Duration getMaximumResponseDelay() { + int timeout = + config + .getInt(SESSION_QUEUE_SECTION, "maximum-response-delay") + .orElse(MAXIMUM_RESPONSE_DELAY); + + return Duration.ofSeconds(timeout); + } + public Duration getSessionRequestTimeout() { // If the user sets 0 or less, we default to 1s. int timeout = diff --git a/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java b/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java index 66df209de1d58..9d4d775b84ae4 100644 --- a/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java +++ b/java/src/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueue.java @@ -96,6 +96,7 @@ public class LocalNewSessionQueue extends NewSessionQueue implements Closeable { private static final String NAME = "Local New Session Queue"; private final SlotMatcher slotMatcher; private final Duration requestTimeout; + private final Duration maximumResponseDelay; private final int batchSize; private final Map requests; private final Map contexts; @@ -115,6 +116,7 @@ public LocalNewSessionQueue( SlotMatcher slotMatcher, Duration requestTimeoutCheck, Duration requestTimeout, + Duration maximumResponseDelay, Secret registrationSecret, int batchSize) { super(tracer, registrationSecret); @@ -123,6 +125,7 @@ public LocalNewSessionQueue( Require.nonNegative("Retry period", requestTimeoutCheck); this.requestTimeout = Require.positive("Request timeout", requestTimeout); + this.maximumResponseDelay = Require.positive("Maximum response delay", maximumResponseDelay); this.requests = new ConcurrentHashMap<>(); this.queue = new ConcurrentLinkedDeque<>(); @@ -152,6 +155,7 @@ public static NewSessionQueue create(Config config) { slotMatcher, newSessionQueueOptions.getSessionRequestTimeoutPeriod(), newSessionQueueOptions.getSessionRequestTimeout(), + newSessionQueueOptions.getMaximumResponseDelay(), secretOptions.getRegistrationSecret(), newSessionQueueOptions.getBatchSize()); } @@ -234,7 +238,9 @@ public HttpResponse addToQueue(SessionRequest request) { } Lock writeLock = this.lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { requests.remove(request.getRequestId()); queue.remove(request); @@ -268,7 +274,9 @@ Data injectIntoQueue(SessionRequest request) { Data data = new Data(request.getEnqueued()); Lock writeLock = lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { requests.put(request.getRequestId(), data); queue.addLast(request); @@ -288,7 +296,9 @@ public boolean retryAddToQueue(SessionRequest request) { contexts.getOrDefault(request.getRequestId(), tracer.getCurrentContext()); try (Span ignored = context.createSpan("sessionqueue.retry")) { Lock writeLock = lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { if (!requests.containsKey(request.getRequestId())) { return false; @@ -319,7 +329,9 @@ public Optional remove(RequestId reqId) { Require.nonNull("Request ID", reqId); Lock writeLock = lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { Iterator iterator = queue.iterator(); while (iterator.hasNext()) { @@ -340,6 +352,29 @@ public Optional remove(RequestId reqId) { public List getNextAvailable(Map stereotypes) { Require.nonNull("Stereotypes", stereotypes); + // use nano time to avoid issues with a jumping clock e.g. on WSL2 or due to time-sync + long started = System.nanoTime(); + // delay the response to avoid heavy polling via http + while (maximumResponseDelay.toNanos() > System.nanoTime() - started) { + Lock readLock = lock.readLock(); + readLock.lock(); + + try { + if (!queue.isEmpty()) { + break; + } + } finally { + readLock.unlock(); + } + + try { + Thread.sleep(10); + } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); + break; + } + } + Predicate matchesStereotype = caps -> stereotypes.entrySet().stream() @@ -355,7 +390,9 @@ public List getNextAvailable(Map stereotypes }); Lock writeLock = lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { List availableRequests = queue.stream() @@ -381,7 +418,9 @@ public boolean complete( try (Span ignored = context.createSpan("sessionqueue.completed")) { Data data; Lock writeLock = lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { data = requests.remove(reqId); queue.removeIf(req -> reqId.equals(req.getRequestId())); @@ -401,7 +440,9 @@ public boolean complete( @Override public int clearQueue() { Lock writeLock = lock.writeLock(); - writeLock.lock(); + if (!writeLock.tryLock()) { + writeLock.lock(); + } try { int size = queue.size(); diff --git a/java/test/org/openqa/selenium/grid/distributor/AddingNodesTest.java b/java/test/org/openqa/selenium/grid/distributor/AddingNodesTest.java index 1485d04fca4c6..b9776936210f6 100644 --- a/java/test/org/openqa/selenium/grid/distributor/AddingNodesTest.java +++ b/java/test/org/openqa/selenium/grid/distributor/AddingNodesTest.java @@ -109,6 +109,7 @@ public void setUpDistributor() throws MalformedURLException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/distributor/DistributorDrainingTest.java b/java/test/org/openqa/selenium/grid/distributor/DistributorDrainingTest.java index 13e9bc533f4ba..1170c1e73149f 100644 --- a/java/test/org/openqa/selenium/grid/distributor/DistributorDrainingTest.java +++ b/java/test/org/openqa/selenium/grid/distributor/DistributorDrainingTest.java @@ -54,6 +54,7 @@ void drainedNodeDoesNotShutDownIfNotEmpty() throws InterruptedException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); LocalNode node = @@ -106,6 +107,7 @@ void drainedNodeShutsDownAfterSessionsFinish() throws InterruptedException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); LocalNode node = @@ -182,6 +184,7 @@ void testDrainedNodeShutsDownOnceEmpty() throws InterruptedException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); LocalNode node = @@ -234,6 +237,7 @@ void drainingNodeDoesNotAcceptNewSessions() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); LocalNode node = diff --git a/java/test/org/openqa/selenium/grid/distributor/DistributorNodeAvailabilityTest.java b/java/test/org/openqa/selenium/grid/distributor/DistributorNodeAvailabilityTest.java index daf24309b53bf..97dddc4f19898 100644 --- a/java/test/org/openqa/selenium/grid/distributor/DistributorNodeAvailabilityTest.java +++ b/java/test/org/openqa/selenium/grid/distributor/DistributorNodeAvailabilityTest.java @@ -97,6 +97,7 @@ void shouldBeAbleToRemoveANode() throws MalformedURLException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -147,6 +148,7 @@ void shouldIncludeHostsThatAreUpInHostList() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(sessions); @@ -219,6 +221,7 @@ void shouldNotRemoveNodeWhoseHealthCheckPassesBeforeThreshold() throws Interrupt new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -281,6 +284,7 @@ void shouldReturnNodesThatWereDownToPoolOfNodesOnceTheyMarkTheirHealthCheckPasse new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -338,6 +342,7 @@ void shouldBeAbleToAddANodeAndCreateASession() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); LocalNode node = diff --git a/java/test/org/openqa/selenium/grid/distributor/DistributorTest.java b/java/test/org/openqa/selenium/grid/distributor/DistributorTest.java index 5776adf158600..1fcb2be6e1e07 100644 --- a/java/test/org/openqa/selenium/grid/distributor/DistributorTest.java +++ b/java/test/org/openqa/selenium/grid/distributor/DistributorTest.java @@ -84,6 +84,7 @@ void creatingASessionAddsItToTheSessionMap() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -134,6 +135,7 @@ void shouldReleaseSlotOnceSessionEnds() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -203,6 +205,7 @@ void shouldNotStartASessionIfTheCapabilitiesAreNotSupported() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(sessions); @@ -243,6 +246,7 @@ void attemptingToStartASessionWhichFailsMarksAsTheSlotAsAvailable() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/distributor/DistributorTestBase.java b/java/test/org/openqa/selenium/grid/distributor/DistributorTestBase.java index 664655a695b6f..c54e5826ca7a7 100644 --- a/java/test/org/openqa/selenium/grid/distributor/DistributorTestBase.java +++ b/java/test/org/openqa/selenium/grid/distributor/DistributorTestBase.java @@ -106,6 +106,7 @@ public void setUp() throws URISyntaxException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/distributor/SessionSchedulingTest.java b/java/test/org/openqa/selenium/grid/distributor/SessionSchedulingTest.java index 4ca45082e4cb4..5b4b8ad209f83 100644 --- a/java/test/org/openqa/selenium/grid/distributor/SessionSchedulingTest.java +++ b/java/test/org/openqa/selenium/grid/distributor/SessionSchedulingTest.java @@ -66,6 +66,7 @@ void theMostLightlyLoadedNodeIsSelectedFirst() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -121,6 +122,7 @@ void shouldUseLastSessionCreatedTimeAsTieBreaker() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); Node leastRecent = createNode(caps, 5, 0); @@ -192,6 +194,7 @@ void shouldNotScheduleAJobIfAllSlotsAreBeingUsed() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -247,6 +250,7 @@ void shouldPrioritizeHostsWithTheMostSlotsAvailableForASessionType() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/distributor/local/LocalDistributorTest.java b/java/test/org/openqa/selenium/grid/distributor/local/LocalDistributorTest.java index 3ce2fe80d8352..af5adb64025e0 100644 --- a/java/test/org/openqa/selenium/grid/distributor/local/LocalDistributorTest.java +++ b/java/test/org/openqa/selenium/grid/distributor/local/LocalDistributorTest.java @@ -118,6 +118,7 @@ void testAddNodeToDistributor() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); Distributor distributor = @@ -157,6 +158,7 @@ void testRemoveNodeFromDistributor() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); Distributor distributor = @@ -195,6 +197,7 @@ void testAddSameNodeTwice() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); Distributor distributor = @@ -228,6 +231,7 @@ void shouldBeAbleToAddMultipleSessionsConcurrently() throws Exception { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); @@ -321,6 +325,7 @@ void testDrainNodeFromDistributor() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); Distributor distributor = @@ -366,6 +371,7 @@ void testDrainNodeFromNode() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); Distributor distributor = @@ -396,6 +402,7 @@ void slowStartingNodesShouldNotCauseReservationsToBeSerialized() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/graphql/GraphqlHandlerTest.java b/java/test/org/openqa/selenium/grid/graphql/GraphqlHandlerTest.java index e14db18b8a0bc..3a442dac664d4 100644 --- a/java/test/org/openqa/selenium/grid/graphql/GraphqlHandlerTest.java +++ b/java/test/org/openqa/selenium/grid/graphql/GraphqlHandlerTest.java @@ -121,6 +121,7 @@ public void setupGrid() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/router/JmxTest.java b/java/test/org/openqa/selenium/grid/router/JmxTest.java index 2369abb4c60c1..2561eee7f8871 100644 --- a/java/test/org/openqa/selenium/grid/router/JmxTest.java +++ b/java/test/org/openqa/selenium/grid/router/JmxTest.java @@ -225,6 +225,7 @@ void shouldBeAbleToRegisterSessionQueue() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), new Secret(""), 5); @@ -278,6 +279,7 @@ void shouldBeAbleToMonitorHub() throws Exception { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), secret, 5); diff --git a/java/test/org/openqa/selenium/grid/router/NewSessionCreationTest.java b/java/test/org/openqa/selenium/grid/router/NewSessionCreationTest.java index a19476080d410..5ff4d19a37754 100644 --- a/java/test/org/openqa/selenium/grid/router/NewSessionCreationTest.java +++ b/java/test/org/openqa/selenium/grid/router/NewSessionCreationTest.java @@ -101,6 +101,7 @@ void ensureJsCannotCreateANewSession() throws URISyntaxException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(60), + Duration.ofSeconds(1), registrationSecret, 5); @@ -189,6 +190,7 @@ void shouldNotRetryNewSessionRequestOnUnexpectedError() throws URISyntaxExceptio new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(10), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(queue); @@ -264,6 +266,7 @@ void shouldRejectRequestForUnsupportedCaps() throws URISyntaxException { new DefaultSlotMatcher(), Duration.ofSeconds(5), Duration.ofSeconds(60), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(queue); diff --git a/java/test/org/openqa/selenium/grid/router/RouterTest.java b/java/test/org/openqa/selenium/grid/router/RouterTest.java index 15d36c5291963..352495f738ed4 100644 --- a/java/test/org/openqa/selenium/grid/router/RouterTest.java +++ b/java/test/org/openqa/selenium/grid/router/RouterTest.java @@ -128,6 +128,7 @@ public void setUp() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(queue); diff --git a/java/test/org/openqa/selenium/grid/router/SessionCleanUpTest.java b/java/test/org/openqa/selenium/grid/router/SessionCleanUpTest.java index d6a8e529df597..9944736ccb727 100644 --- a/java/test/org/openqa/selenium/grid/router/SessionCleanUpTest.java +++ b/java/test/org/openqa/selenium/grid/router/SessionCleanUpTest.java @@ -145,6 +145,7 @@ void shouldRemoveSessionAfterNodeIsShutDownGracefully() { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(10), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(queue); @@ -261,6 +262,7 @@ void shouldRemoveSessionAfterNodeIsDown() throws URISyntaxException { new DefaultSlotMatcher(), Duration.ofSeconds(2), Duration.ofSeconds(2), + Duration.ofSeconds(1), registrationSecret, 5); diff --git a/java/test/org/openqa/selenium/grid/router/SessionQueueGridTest.java b/java/test/org/openqa/selenium/grid/router/SessionQueueGridTest.java index 246dc41b10d5e..be3d74506d727 100644 --- a/java/test/org/openqa/selenium/grid/router/SessionQueueGridTest.java +++ b/java/test/org/openqa/selenium/grid/router/SessionQueueGridTest.java @@ -110,6 +110,7 @@ public void setup() throws URISyntaxException, MalformedURLException { new DefaultSlotMatcher(), Duration.ofSeconds(5), Duration.ofSeconds(60), + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(queue); diff --git a/java/test/org/openqa/selenium/grid/router/SessionQueueGridWithTimeoutTest.java b/java/test/org/openqa/selenium/grid/router/SessionQueueGridWithTimeoutTest.java index 9e67ccf4d1b6c..cd48aef93b0ba 100644 --- a/java/test/org/openqa/selenium/grid/router/SessionQueueGridWithTimeoutTest.java +++ b/java/test/org/openqa/selenium/grid/router/SessionQueueGridWithTimeoutTest.java @@ -108,6 +108,7 @@ public void setup() throws URISyntaxException, MalformedURLException { new DefaultSlotMatcher(), Duration.ofSeconds(1), Duration.ofSeconds(5), // low timeout to allow simulating it + Duration.ofSeconds(1), registrationSecret, 5); handler.addHandler(queue); diff --git a/java/test/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueueTest.java b/java/test/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueueTest.java index b099243066e26..97f85db5bfd9a 100644 --- a/java/test/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueueTest.java +++ b/java/test/org/openqa/selenium/grid/sessionqueue/local/LocalNewSessionQueueTest.java @@ -129,6 +129,7 @@ public static Stream data() { new DefaultSlotMatcher(), Duration.ofSeconds(1), Duration.ofSeconds(Debug.isDebugging() ? 9999 : 5), + Duration.ofSeconds(1), REGISTRATION_SECRET, 5); return new TestData(local, local); @@ -142,6 +143,7 @@ public static Stream data() { new DefaultSlotMatcher(), Duration.ofSeconds(1), Duration.ofSeconds(Debug.isDebugging() ? 9999 : 5), + Duration.ofSeconds(1), REGISTRATION_SECRET, 5); From c6323a52510b9a3f07e0e1952707f84540e422ec Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Wed, 25 Dec 2024 05:47:44 +0700 Subject: [PATCH 2/2] Update variable naming with prefix `DEFAULT_` Signed-off-by: Viet Nguyen Duc --- .../grid/sessionqueue/config/NewSessionQueueOptions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java b/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java index 1e157623879cc..ef6e74e2736c5 100644 --- a/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java +++ b/java/src/org/openqa/selenium/grid/sessionqueue/config/NewSessionQueueOptions.java @@ -35,7 +35,7 @@ public class NewSessionQueueOptions { static final String SESSION_QUEUE_SECTION = "sessionqueue"; - static final int MAXIMUM_RESPONSE_DELAY = 8; + static final int DEFAULT_MAXIMUM_RESPONSE_DELAY = 8; static final int DEFAULT_REQUEST_TIMEOUT = 300; static final int DEFAULT_REQUEST_TIMEOUT_PERIOD = 10; static final int DEFAULT_RETRY_INTERVAL = 15; @@ -94,7 +94,7 @@ public Duration getMaximumResponseDelay() { int timeout = config .getInt(SESSION_QUEUE_SECTION, "maximum-response-delay") - .orElse(MAXIMUM_RESPONSE_DELAY); + .orElse(DEFAULT_MAXIMUM_RESPONSE_DELAY); return Duration.ofSeconds(timeout); }