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 (#23957)
  • Loading branch information
hanmz authored Feb 11, 2025
1 parent 7f595cd commit 6db275c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ public void updateMessageTTL(int messageTTLInSeconds) {

@Override
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 6db275c

Please sign in to comment.