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

Issue #448 make state thread safe in consumer_partition and connection #451

Merged
merged 4 commits into from
Jan 26, 2021
Merged
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
Prev Previous commit
Apply suggestions from code review
  • Loading branch information
merlimat authored Jan 26, 2021
commit 2d36d0e0e049fdf16b8532ecfd8eccc215445fdc
8 changes: 4 additions & 4 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (p *partitionProducer) reconnectToBroker() {
}

for maxRetry != 0 {
if p.getProduerState() != producerReady {
if p.getProducerState() != producerReady {
// Producer is already closing
return
}
Expand Down Expand Up @@ -447,7 +447,7 @@ func (p *partitionProducer) internalFlushCurrentBatch() {

func (p *partitionProducer) failTimeoutMessages() {
// since Closing/Closed connection couldn't be reopen, load and compare is safe
state := p.getProduerState()
state := p.getProducerState()
if state == producerClosing || state == producerClosed {
return
}
Expand Down Expand Up @@ -707,7 +707,7 @@ func (p *partitionProducer) Flush() error {
return cp.err
}

func (p *partitionProducer) getProduerState() producerState {
func (p *partitionProducer) getProducerState() producerState {
return producerState(p.state.Load())
}

Expand All @@ -722,7 +722,7 @@ func (p *partitionProducer) casProducerState(oldState, newState producerState) b
}

func (p *partitionProducer) Close() {
if p.getProduerState() != producerReady {
if p.getProducerState() != producerReady {
// Producer is closing
return
}
Expand Down