Copilot commented on code in PR #4710:
URL: https://github.com/apache/solr/pull/4710#discussion_r4668648249
##########
solr/core/src/java/org/apache/solr/cli/StatusTool.java:
##########
@@ -227,11 +228,21 @@ public int runTool() throws Exception {
}
if (port != null) {
- Optional<SolrProcess> proc = processMgr.processForPort(port);
+ // When asked to wait, this also waits for a newly started process to
become visible. One
+ // budget covers both that and the HTTP wait below, so that the time
spent finding the
+ // process does not extend --max-wait-secs.
+ TimeOut timeout = new TimeOut(maxWaitSecs, TimeUnit.SECONDS,
TimeSource.NANO_TIME);
+ Optional<SolrProcess> proc = processMgr.waitForProcessOnPort(port,
maxWaitSecs);
+ long secsLeft = maxWaitSecs > 0 ? timeout.timeLeft(TimeUnit.SECONDS) : 0;
Review Comment:
`TimeOut.timeLeft(SECONDS)` truncates fractional seconds, so `status -p
<port> --max-wait-secs 1` rejects even an already-running, ready instance: any
time spent looking up the process leaves less than one second, making
`secsLeft` zero before any HTTP request is attempted. Longer waits also discard
their final fractional second. Check expiration using the actual deadline and
pass the remaining budget to the readiness loop at finer precision, rather than
treating zero whole seconds as expired.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]