Skip to content

Commit

Permalink
produce: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
fgeller committed Sep 9, 2023
1 parent 5f40182 commit 5b7390c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions produce.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,13 @@ func (cmd *produceCmd) deserializeLines(in chan string, out chan message, partit
}

var part int32 = 0
if msg.Value != nil && cmd.partitioner == "hashCodeByValue" {
part = hashCodePartition(*msg.Value, partitionCount)
msg.Partition = &part
} else {
if msg.Key != nil && cmd.partitioner == "hashCode" {
if msg.Partition == nil {
if msg.Value != nil && cmd.partitioner == "hashCodeByValue" {
part = hashCodePartition(*msg.Value, partitionCount)
} else if msg.Key != nil && cmd.partitioner == "hashCode" {
part = hashCodePartition(*msg.Key, partitionCount)
}
if msg.Partition == nil {
msg.Partition = &part
}
msg.Partition = &part
}

out <- msg
Expand Down

0 comments on commit 5b7390c

Please sign in to comment.