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


##########
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:
   My intent is that negative numbers will default to using the number of 
available processors. However, I originally was not catching `0 == threads` but 
later decided that it made more sense to treat `0 == threads` as meaning "no 
threading". That behavior seems more consistent with the `facet.threads` 
parameter which has the similar behavior for a value of 0 and negative values.
   
   



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