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

[PR-1071-1] rename pendingItem.Complete() to pendingItem.done() #1109

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
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
16 changes: 8 additions & 8 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ type pendingItem struct {
sequenceID uint64
sentAt time.Time
sendRequests []interface{}
completed bool
isDone bool
flushCallback func(err error)
}

Expand Down Expand Up @@ -1001,7 +1001,7 @@ func (p *partitionProducer) failTimeoutMessages() {
}

// flag the sending has completed with error, flush make no effect
pi.Complete(errSendTimeout)
pi.done(errSendTimeout)
pi.Unlock()

// finally reached the last view item, current iteration ends
Expand Down Expand Up @@ -1076,7 +1076,7 @@ func (p *partitionProducer) internalFlush(fr *flushRequest) {
pi.Lock()
defer pi.Unlock()

if pi.completed {
if pi.isDone {
// The last item in the queue has been completed while we were
// looking at it. It's safe at this point to assume that every
// message enqueued before Flush() was called are now persisted
Expand Down Expand Up @@ -1281,7 +1281,7 @@ func (p *partitionProducer) ReceivedSendReceipt(response *pb.CommandSendReceipt)
}

// Mark this pending item as done
pi.Complete(nil)
pi.done(nil)
}
}

Expand Down Expand Up @@ -1365,7 +1365,7 @@ func (p *partitionProducer) failPendingMessages() {
}

// flag the sending has completed with error, flush make no effect
pi.Complete(errProducerClosed)
pi.done(errProducerClosed)
pi.Unlock()

// finally reached the last view item, current iteration ends
Expand Down Expand Up @@ -1452,11 +1452,11 @@ type flushRequest struct {
err error
}

func (i *pendingItem) Complete(err error) {
if i.completed {
func (i *pendingItem) done(err error) {
if i.isDone {
return
}
i.completed = true
i.isDone = true
buffersPool.Put(i.buffer)
if i.flushCallback != nil {
i.flushCallback(err)
Expand Down