Skip to content

Commit

Permalink
kfake: fix handling ListOffsets with requested timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
narqo committed Apr 12, 2024
1 parent 351e7fa commit 5d8aa1c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/kfake/02_list_offsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ func (c *Cluster) handleListOffsets(b *broker, kreq kmsg.Request) (kmsg.Response
sp.Offset = pd.highWatermark
}
default:
// returns the index of the first batch _after_ the requested timestamp
idx, _ := sort.Find(len(pd.batches), func(idx int) int {
maxEarlier := pd.batches[idx].maxEarlierTimestamp
switch {
case maxEarlier < rp.Timestamp:
case maxEarlier > rp.Timestamp:
return -1
case maxEarlier == rp.Timestamp:
return 0
Expand Down

0 comments on commit 5d8aa1c

Please sign in to comment.