Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]: Support auto scaled consumer receiver queue #976

Merged
merged 7 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pulsar/consumer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -1321,14 +1321,13 @@ func (pc *partitionConsumer) dispatcher() {
} else if nextMessageInQueue == nil {
nextMessageInQueue = toTrackingMessageID(m[0].msgID)
}
if pc.options.autoReceiverQueueSize {
pc.incomingMessages.Sub(int32(len(m)))
}
}

messages = nil

if pc.options.autoReceiverQueueSize {
pc.incomingMessages.Store(0)
}

clearQueueCb(nextMessageInQueue)
}
}
Expand Down
3 changes: 0 additions & 3 deletions pulsar/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4030,9 +4030,6 @@ func TestConsumerWithAutoScaledQueueReceive(t *testing.T) {
_, err = c.Receive(context.Background())
assert.Nil(t, err)

// waiting for prefetched message passing from queueCh to dispatcher()
time.Sleep(time.Second)
shibd marked this conversation as resolved.
Show resolved Hide resolved

// currentQueueSize should be doubled in size
assert.Equal(t, 2, int(pc.currentQueueSize.Load()))

Expand Down