Skip to content

Fix BufferMap.clear() leaving stale total - #11182

Open
adityajai119 wants to merge 1 commit into
celery:mainfrom
adityajai119:fix-buffermap-clear-total
Open

adityajai119 wants to merge 1 commit into
celery:mainfrom
adityajai119:fix-buffermap-clear-total

Conversation

@adityajai119

Copy link
Copy Markdown

BufferMap inherits ChainMap.clear(), which clears the changes mapping but leaves the maintained total counter untouched. After a clear, total still reflects the removed messages, so the next put() immediately triggers eviction and can drop the newly added item.

This overrides clear() to reset total to zero, with a regression test that fails before the fix.

@atishay-kasliwal atishay-kasliwal left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After BufferMap.clear(), total is now 0 (master kept 4). Refilling past the limit evicts correctly: 11 puts keep 10 items, where master kept only 6 because of the stale total.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants