Skip to content

Commit

Permalink
Consumer lost message ack due to race condition in acknowledge with b…
Browse files Browse the repository at this point in the history
…atch message
  • Loading branch information
Shawyeok committed Mar 26, 2024
1 parent a52945b commit d5de766
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ static boolean acknowledge(MessageIdAdv msgId, boolean individual) {
return false;
}
int batchIndex = msgId.getBatchIndex();
if (individual) {
ackSet.clear(batchIndex);
} else {
ackSet.clear(0, batchIndex + 1);
synchronized (ackSet) {
if (individual) {
ackSet.clear(batchIndex);
} else {
ackSet.clear(0, batchIndex + 1);
}
return ackSet.isEmpty();
}
return ackSet.isEmpty();
}

static boolean isBatch(MessageIdAdv msgId) {
Expand Down

0 comments on commit d5de766

Please sign in to comment.