Skip to content

Commit

Permalink
Use uint ptr instead int64
Browse files Browse the repository at this point in the history
  • Loading branch information
shibd committed Feb 6, 2023
1 parent aec822e commit 6a9afbc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type partitionProducer struct {
metrics *internal.LeveledMetrics
epoch uint64
schemaCache *schemaCache
topicEpoch int64
topicEpoch *uint64
}

type schemaCache struct {
Expand Down Expand Up @@ -162,7 +162,6 @@ func newPartitionProducer(client *client, topic string, options *ProducerOptions
metrics: metrics,
epoch: 0,
schemaCache: newSchemaCache(),
topicEpoch: -1,
}
if p.options.DisableBatching {
p.batchFlushTicker.Stop()
Expand Down Expand Up @@ -242,8 +241,8 @@ func (p *partitionProducer) grabCnx() error {
ProducerAccessMode: toProtoProducerAccessMode(p.options.ProducerAccessMode).Enum(),
}

if p.topicEpoch > -1 {
cmdProducer.TopicEpoch = proto.Uint64(uint64(p.topicEpoch))
if p.topicEpoch != nil {
cmdProducer.TopicEpoch = proto.Uint64(*p.topicEpoch)
}

if p.producerName != "" {
Expand All @@ -260,7 +259,8 @@ func (p *partitionProducer) grabCnx() error {
}

p.producerName = res.Response.ProducerSuccess.GetProducerName()
p.topicEpoch = int64(res.Response.ProducerSuccess.GetTopicEpoch())
nextTopicEpoch := res.Response.ProducerSuccess.GetTopicEpoch()
p.topicEpoch = &nextTopicEpoch

if p.options.Encryption != nil {
p.encryptor = internalcrypto.NewProducerEncryptor(p.options.Encryption.Keys,
Expand Down

0 comments on commit 6a9afbc

Please sign in to comment.