Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 9b52b1a

Browse files
authored
Merge pull request #1328 from grafana/kafka_notifier_timeout_oldest
NotifierKafka: avoid timeout case when there are no persist messages and using OffsetOldest or offsetDuration
2 parents 66ace62 + 635d649 commit 9b52b1a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mdata/notifierKafka/notifierKafka.go

+4
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ func (c *NotifierKafka) start() {
8282
if err != nil {
8383
log.Fatalf("kafka-cluster: failed to get offset %d: %s", offsetTime, err)
8484
}
85+
if startOffset < 0 {
86+
// happens when OffsetOldest or an offsetDuration was used and there is no message in the partition
87+
startOffset = 0
88+
}
8589
processBacklog.Add(1)
8690
go c.consumePartition(topic, partition, startOffset, processBacklog)
8791
}

0 commit comments

Comments
 (0)