Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #8332] fix: ack msg which has reached maxReconsumeTimes #8333

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public void run() {
processQueue.decFoundMsg(-msgs.size());
}

log.warn("processQueue invalid. isDropped={}, isPopTimeout={}, messageQueue={}, msgs={}",
log.warn("processQueue invalid or popTimeout. isDropped={}, isPopTimeout={}, messageQueue={}, msgs={}",
processQueue.isDropped(), isPopTimeout(), messageQueue, msgs);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,17 +621,18 @@ public void onException(Throwable e) {
private PopResult processPopResult(final PopResult popResult, final SubscriptionData subscriptionData) {
if (PopStatus.FOUND == popResult.getPopStatus()) {
List<MessageExt> msgFoundList = popResult.getMsgFoundList();
List<MessageExt> msgListFilterAgain = msgFoundList;
List<MessageExt> msgListFilterAgain = new ArrayList<>(popResult.getMsgFoundList().size());
if (!subscriptionData.getTagsSet().isEmpty() && !subscriptionData.isClassFilterMode()
&& popResult.getMsgFoundList().size() > 0) {
msgListFilterAgain = new ArrayList<>(popResult.getMsgFoundList().size());
for (MessageExt msg : popResult.getMsgFoundList()) {
if (msg.getTags() != null) {
if (subscriptionData.getTagsSet().contains(msg.getTags())) {
msgListFilterAgain.add(msg);
}
}
}
} else {
msgListFilterAgain.addAll(msgFoundList);
}

if (!this.filterMessageHookList.isEmpty()) {
Expand All @@ -649,6 +650,15 @@ private PopResult processPopResult(final PopResult popResult, final Subscription
}
}

Iterator<MessageExt> iterator = msgListFilterAgain.iterator();
while (iterator.hasNext()) {
MessageExt msg = iterator.next();
if (msg.getReconsumeTimes() > defaultMQPushConsumer.getMaxReconsumeTimes()) {
iterator.remove();
log.info("Reconsume times has reached {}, so ack msg={}", msg.getReconsumeTimes(), msg);
}
}

if (msgFoundList.size() != msgListFilterAgain.size()) {
for (MessageExt msg : msgFoundList) {
if (!msgListFilterAgain.contains(msg)) {
Expand Down
Loading