Skip to content

Commit

Permalink
Merge pull request twmb#707 from narqo/kfake-listoffsets-ts
Browse files Browse the repository at this point in the history
kfake: fix handling ListOffsets when Timestamp is requested
  • Loading branch information
twmb authored Apr 12, 2024
2 parents 351e7fa + 5d8aa1c commit 6a58760
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 6a58760

Please sign in to comment.