Repository navigation
fix: Fix queue flow control initialization before dispatching pulls - #1245
Merged
ShannonDing merged 1 commit intoOct 23, 2026
Merged
ShannonDing merged 1 commit into
ShannonDing merged 1 commit into
Conversation
ShannonDing
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Prevent push consumers from pulling with stale/default queue thresholds while rebalance is still initializing the remaining queues. Currently, each queue's pull request is dispatched immediately after its offset lookup, but topic-derived thresholds are applied only after the initialization loop returns. With a backlog and slow offset lookups, earlier queues can pull multiple batches using the default 1024-message / 512-MiB limits.
For example, a 5000-message / 64-MiB topic budget across 64 queues should produce 78-message / 1-MiB queue thresholds before those queues begin pulling.
Brief changelog
messageQueueChanged.This preserves the existing threshold calculation and batch-level flow-control behavior. It does not introduce a hard global memory limit or include temporary diagnostic logging.
Verifying this change
go test -race ./consumer -run '^TestRebalance' -count=5 -timeout=120spassed.TestNewStatsManagerpassed with Go 1.18.10.