Skip to content

Commit

Permalink
relocate nil hash
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn committed Dec 6, 2023
1 parent af010d8 commit 834381f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions producer/proto/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ func (m *ProtoProducerMessage) MarshalText() ([]byte, error) {
}

func (m *ProtoProducerMessage) baseKey(h hash.Hash) {
if m.formatter == nil || len(m.formatter.key) == 0 {
return
}
vfm := reflect.ValueOf(m)
vfm = reflect.Indirect(vfm)

Expand Down Expand Up @@ -72,6 +69,9 @@ func (m *ProtoProducerMessage) baseKey(h hash.Hash) {
}

func (m *ProtoProducerMessage) Key() []byte {
if m.formatter == nil || len(m.formatter.key) == 0 {
return nil
}
h := fnv.New32()
m.baseKey(h)
return h.Sum(nil)
Expand Down

0 comments on commit 834381f

Please sign in to comment.