biningo commented on code in PR #8071: URL: https://github.com/apache/rocketmq/pull/8071#discussion_r1598683474
########## client/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java: ########## @@ -190,35 +189,11 @@ public void submitConsumeRequest( final MessageQueue messageQueue, final boolean dispatchToConsume) { final int consumeBatchSize = this.defaultMQPushConsumer.getConsumeMessageBatchMaxSize(); - if (msgs.size() <= consumeBatchSize) { - ConsumeRequest consumeRequest = new ConsumeRequest(msgs, processQueue, messageQueue); - try { - this.consumeExecutor.submit(consumeRequest); - } catch (RejectedExecutionException e) { - this.submitConsumeRequestLater(consumeRequest); - } - } else { - for (int total = 0; total < msgs.size(); ) { - List<MessageExt> msgThis = new ArrayList<>(consumeBatchSize); - for (int i = 0; i < consumeBatchSize; i++, total++) { - if (total < msgs.size()) { - msgThis.add(msgs.get(total)); - } else { - break; - } - } - - ConsumeRequest consumeRequest = new ConsumeRequest(msgThis, processQueue, messageQueue); - try { - this.consumeExecutor.submit(consumeRequest); - } catch (RejectedExecutionException e) { - for (; total < msgs.size(); total++) { - msgThis.add(msgs.get(total)); - } - - this.submitConsumeRequestLater(consumeRequest); - } - } + int batch = ((msgs.size() - 1) / consumeBatchSize) + 1; Review Comment: Oh yeah! It's not very readable here. I've optimized it. Thanks for your suggestion. -- 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...@rocketmq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org