[ 
https://issues.apache.org/jira/browse/ARTEMIS-2515?focusedWorklogId=326914&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-326914
 ]

ASF GitHub Bot logged work on ARTEMIS-2515:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Oct/19 14:03
            Start Date: 11/Oct/19 14:03
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on pull request #2861: 
ARTEMIS-2515 pageIterator.hasNext spends too much time in the case of no 
messages matched
URL: https://github.com/apache/activemq-artemis/pull/2861#discussion_r334007365
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
 ##########
 @@ -2680,24 +2684,24 @@ private boolean deliver() {
 
       int handled = 0;
 
-      long timeout = System.currentTimeMillis() + DELIVERY_TIMEOUT;
+      long timeout = System.nanoTime() + 
TimeUnit.MILLISECONDS.toNanos(DELIVERY_TIMEOUT);
       consumers.reset();
       while (true) {
          if (handled == MAX_DELIVERIES_IN_LOOP) {
             // Schedule another one - we do this to prevent a single thread 
getting caught up in this loop for too
             // long
 
-            deliverAsync();
+            deliverAsync(true);
 
             return false;
          }
 
-         if (System.currentTimeMillis() > timeout) {
+         if (System.nanoTime() > timeout) {
 
 Review comment:
   I remember not long ago, we had to change a few nanoTime operations to avoid 
overflow.
   
   I think, based on that the correct would be System.nanoTime() - timeout > 0
   
   There was a previous big commit where we changed a few like this... the 
commit I could find where Franz changed something similar was 
35c3475092576e7b008220f7c39b78e15850d5fd
   
   
   Can you make that change here please?
   
   
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 326914)
    Time Spent: 40m  (was: 0.5h)

> pageIterator.hasNext spends too much time in the case of no messages matched
> ----------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2515
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2515
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 2.10.1
>            Reporter: Wei Yang
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Discussion thread hereĀ 
> [http://activemq.2283324.n4.nabble.com/DISCUSS-Artemis-pageIterator-hasNext-spends-too-much-time-in-the-case-of-no-messages-matched-td4752397.html]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to