RobertIndie commented on code in PR #1437:
URL: https://github.com/apache/pulsar-client-go/pull/1437#discussion_r2536150682
##########
pulsar/producer_impl.go:
##########
@@ -277,8 +280,8 @@ func (p *producer) internalCreatePartitionsProducers()
error {
} else {
p.metrics.ProducersPartitions.Add(float64(partitionsToAdd))
}
- atomic.StorePointer(&p.producersPtr, unsafe.Pointer(&p.producers))
- atomic.StoreUint32(&p.numPartitions, uint32(len(p.producers)))
+ atomic.StorePointer(&p.producersPtr, unsafe.Pointer(&producers))
Review Comment:
I agree. I refactored the code to simply use `atomic.Value` to hold the
producers slice. Each producer can now obtain the current number of partitions
just by checking the length of that slice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]