Github user arunmahadevan commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2147#discussion_r119409290
  
    --- Diff: 
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/KafkaSpout.java
 ---
    @@ -252,14 +289,16 @@ private boolean commit() {
         private boolean poll() {
             final int maxUncommittedOffsets = 
kafkaSpoutConfig.getMaxUncommittedOffsets();
             final int readyMessageCount = retryService.readyMessageCount();
    -        final boolean poll = !waitingToEmit() &&
    -            //Check that the number of uncommitted, nonretriable tuples is 
less than the maxUncommittedOffsets limit
    -            //Accounting for retriable tuples this way still guarantees 
that the limit is followed on a per partition basis, and prevents locking up 
the spout when there are too many retriable tuples
    -            (numUncommittedOffsets - readyMessageCount < 
maxUncommittedOffsets ||
    -            consumerAutoCommitMode);
    +        final boolean poll = !isWaitingToEmit() &&
    --- End diff --
    
    If I understood correctly, it can be refactored to something like :
    
    ```java
            boolean result = false;
            if (!isWaitingToEmit()) {
                if (numUncommittedOffsets - readyMessageCount < 
maxUncommittedOffsets || consumerAutoCommitMode) {
                    result = true;
                } else {
                    LOG.debug("Not polling. [{}] uncommitted offsets across all 
topic partitions has reached the threshold of [{}]", numUncommittedOffsets, 
maxUncommittedOffsets);
                }
            } else {
                LOG.debug("Not polling. Tuples waiting to be emitted. [{}] 
uncommitted offsets across all topic partitions", numUncommittedOffsets);
            }
            return result;
            
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to