lburgazzoli commented on code in PR #13273:
URL: https://github.com/apache/camel/pull/13273#discussion_r1499977160


##########
core/camel-main/src/main/java/org/apache/camel/main/MainDurationEventNotifier.java:
##########
@@ -110,10 +121,19 @@ protected void doNotify(CamelEvent event) {
             if (complete) {
                 doneMessages.increment();
                 final int doneCount = doneMessages.intValue();
-                final boolean result = doneCount >= maxMessages;
+                final int inflight = 
camelContext.getInflightRepository().size();
+
+                boolean result = doneCount >= maxMessages;
+                if (result && !maxMessagesIgnoreInflightExchanges) {
+                    result = inflight == 0;
+                }
 
                 if (LOG.isTraceEnabled()) {
-                    LOG.trace("Duration max messages check {} >= {} -> {}", 
doneCount, maxMessages, result);
+                    if (!maxMessagesIgnoreInflightExchanges) {
+                        LOG.trace("Duration max messages check {}/{} >= {} -> 
{}", doneCount, inflight, maxMessages, result);
+                    } else {
+                        LOG.trace("Duration max messages check {} >= {} -> 
{}", doneCount, maxMessages, result);
+                    }

Review Comment:
   would moving the inflight repository check inside the if enough ?
    something like:
   
   ```java 
   int inflight = 0;
   boolean result = doneCount >= maxMessages;
   
   if (result && !maxMessagesIgnoreInflightExchanges) {
       inflight = camelContext.getInflightRepository().size();
       result = inflight == 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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to