aparnasuresh85 commented on code in PR #2493: URL: https://github.com/apache/solr/pull/2493#discussion_r1697023501
########## solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java: ########## @@ -211,23 +216,33 @@ public ShardResponse takeCompletedIncludingErrors() { */ @Override public ShardResponse takeCompletedOrError() { - return take(true); + return take(true, -1); } - private ShardResponse take(boolean bailOnError) { + private ShardResponse take(boolean bailOnError, long maxAllowedTimeInMillis) { try { - while (pending.get() > 0) { - ShardResponse rsp = responses.take(); - responseFutureMap.remove(rsp); + long deadline = System.nanoTime(); + if (maxAllowedTimeInMillis > 0) { + deadline += TimeUnit.MILLISECONDS.toNanos(maxAllowedTimeInMillis); + } else { + deadline = System.nanoTime() + TimeUnit.DAYS.toNanos(1); + } + ShardResponse previousResponse = null; + while (pending.get() > 0) { + long waitTime = deadline - System.nanoTime(); + ShardResponse rsp = responses.poll(waitTime, TimeUnit.NANOSECONDS); pending.decrementAndGet(); + if (rsp == null) return previousResponse; Review Comment: Rather than terminating early when the first request times out, can processing be continued to collect responses for other shard requests? Additionally, maybe not in scope for this JIRA, we could throw an exception upon a shard request timeout to allow LBSolrClient to retry the query on another replica for the shard. -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org