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

[fix] [issue 1057]: Fix the producer flush opertion is not guarantee to flush all messages #1058

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,15 @@ func (p *partitionProducer) internalFlushCurrentBatches() {
}

func (p *partitionProducer) internalFlush(fr *flushRequest) {
// clear all the messages which have sent to dataChan before flush
if len(p.dataChan) != 0 {
oldDataChan := p.dataChan
p.dataChan = make(chan *sendRequest, p.options.MaxPendingMessages)
for len(oldDataChan) != 0 {
pendingData := <-oldDataChan
p.internalSend(pendingData)
}
}

p.internalFlushCurrentBatch()

Expand Down