janhoy commented on code in PR #1861:
URL: https://github.com/apache/solr/pull/1861#discussion_r1302244189


##########
solr/core/src/java/org/apache/solr/core/QuerySenderListener.java:
##########
@@ -44,65 +53,131 @@ public QuerySenderListener(SolrCore core) {
 
   @Override
   public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher 
currentSearcher) {
+    final long startTimeNanos = System.nanoTime();
+
     final SolrIndexSearcher searcher = newSearcher;
     log.debug("QuerySenderListener sending requests to {}", newSearcher);
     @SuppressWarnings("unchecked")
     List<NamedList<Object>> allLists =
         convertQueriesToList((ArrayList<Object>) getArgs().getAll("queries"));
     if (allLists == null) return;
-    for (NamedList<Object> nlst : allLists) {
+    final int threads = getThreadsParam();
+
+    if (0 == threads || 1 == threads || allLists.isEmpty()) { // Non-threaded 
code path
+      for (NamedList<Object> nlst : allLists) {
+        runQuery(newSearcher, currentSearcher, nlst);
+      }
+    } else { // Multi-threaded code path
+      final int nThreads = threads > 0 ? threads : 
Runtime.getRuntime().availableProcessors();

Review Comment:
   The fallback where `threads <= 0` will never happen since the if clause 
above grabs `0 == threads`. Was the intention to auto-configure threads based 
on available CPUs if you configure a negative number, or 0?



-- 
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

Reply via email to