Skip to content

Commit

Permalink
producer: parse directl to uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
tsahee committed Jul 12, 2024
1 parent 7afc0db commit 0690257
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pubsub/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,25 @@ func setMinIdInt(min *[2]uint64, id string) error {
if len(idParts) != 2 {
return errors.New("invalid i.d")
}
idTimeStamp, err := strconv.Atoi(idParts[0])
idTimeStamp, err := strconv.ParseUint(idParts[0], 10, 64)
if err != nil {
return fmt.Errorf("invalid i.d ts: %w", err)
}
if uint64(idTimeStamp) > min[0] {
if idTimeStamp > min[0] {
return nil
}
idSerial, err := strconv.Atoi(idParts[1])
idSerial, err := strconv.ParseUint(idParts[1], 10, 64)
if err != nil {
return fmt.Errorf("invalid i.d serial: %w", err)
}
if uint64(idTimeStamp) < min[0] {
min[0] = uint64(idTimeStamp)
min[1] = uint64(idSerial)
if idTimeStamp < min[0] {
min[0] = idTimeStamp
min[1] = idSerial
return nil
}
// idTimeStamp == min[0]
if uint64(idSerial) < min[1] {
min[1] = uint64(idSerial)
if idSerial < min[1] {
min[1] = idSerial
}
return nil
}
Expand Down

0 comments on commit 0690257

Please sign in to comment.