Skip to content

Commit

Permalink
[improve][broker] Avoid PersistentReplicator.expireMessages logic com…
Browse files Browse the repository at this point in the history
…pute backlog twice (apache#23957)

(cherry picked from commit 6db275c)
  • Loading branch information
hanmz authored and lhotari committed Feb 11, 2025
1 parent 77dc34d commit 921b75e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,8 @@ private long getReplicationDelayInSeconds() {
}

public boolean expireMessages(int messageTTLInSeconds) {
if ((cursor.getNumberOfEntriesInBacklog(false) == 0)
|| (cursor.getNumberOfEntriesInBacklog(false) < MINIMUM_BACKLOG_FOR_EXPIRY_CHECK
long backlog = cursor.getNumberOfEntriesInBacklog(false);
if ((backlog == 0) || (backlog < MINIMUM_BACKLOG_FOR_EXPIRY_CHECK
&& !topic.isOldestMessageExpired(cursor, messageTTLInSeconds))) {
// don't do anything for almost caught-up connected subscriptions
return false;
Expand Down

0 comments on commit 921b75e

Please sign in to comment.