sigram commented on code in PR #2347:
URL: https://github.com/apache/solr/pull/2347#discussion_r1528798498


##########
solr/core/src/java/org/apache/solr/search/CpuAllowedLimit.java:
##########
@@ -57,28 +63,24 @@ public CpuAllowedLimit(SolrQueryRequest req) {
       throw new IllegalArgumentException(
           "Check for limit with hasCpuLimit(req) before creating a 
CpuAllowedLimit");
     }
-    // calculate when the time limit is reached, account for the time already 
spent
-    limitAtNs =
-        threadCpuTimer.getStartCpuTimeNs()
-            + TimeUnit.NANOSECONDS.convert(reqCpuLimit, TimeUnit.MILLISECONDS);
+    // calculate the time when the limit is reached, e.g. account for the time 
already spent
+    requestedTimeoutNs = TimeUnit.NANOSECONDS.convert(reqCpuLimit, 
TimeUnit.MILLISECONDS);
   }
 
   @VisibleForTesting
   CpuAllowedLimit(long limitMs) {
     this.threadCpuTimer = new ThreadCpuTimer();
-    limitAtNs =
-        threadCpuTimer.getCurrentCpuTimeNs()
-            + TimeUnit.NANOSECONDS.convert(limitMs, TimeUnit.MILLISECONDS);
+    requestedTimeoutNs = TimeUnit.NANOSECONDS.convert(limitMs, 
TimeUnit.MILLISECONDS);
   }
 
   /** Return true if the current request has a parameter with a valid value of 
the limit. */
   static boolean hasCpuLimit(SolrQueryRequest req) {
     return req.getParams().getLong(CommonParams.CPU_ALLOWED, -1L) > 0L;
   }
 
-  /** Return true if a max limit value is set and the current usage has 
exceeded the limit. */
+  /** Return true usage has exceeded the limit. */

Review Comment:
   Missing 'if'?



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