Skip to content

Commit 5d8aa1c

Browse files
committed
kfake: fix handling ListOffsets with requested timestamp
1 parent 351e7fa commit 5d8aa1c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎pkg/kfake/02_list_offsets.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ func (c *Cluster) handleListOffsets(b *broker, kreq kmsg.Request) (kmsg.Response
7575
sp.Offset = pd.highWatermark
7676
}
7777
default:
78+
// returns the index of the first batch _after_ the requested timestamp
7879
idx, _ := sort.Find(len(pd.batches), func(idx int) int {
7980
maxEarlier := pd.batches[idx].maxEarlierTimestamp
8081
switch {
81-
case maxEarlier < rp.Timestamp:
82+
case maxEarlier > rp.Timestamp:
8283
return -1
8384
case maxEarlier == rp.Timestamp:
8485
return 0

0 commit comments

Comments
 (0)