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

Commit 136bfe7

Browse files
committed
bugfix: do not unnecessarily multiply backoff time
1 parent 943fa76 commit 136bfe7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kafka/partitions.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func GetPartitions(client *confluent.Consumer, topics []string, retries, timeout
3030
metadata, err := client.GetMetadata(&topic, false, timeout)
3131
if err != nil {
3232
log.Warn("kafka: failed to get metadata from kafka client. %s, %d retries", err, retry)
33-
time.Sleep(time.Duration(backoff) * time.Millisecond)
33+
time.Sleep(backoff)
3434
continue
3535
}
3636

@@ -40,12 +40,12 @@ func GetPartitions(client *confluent.Consumer, topics []string, retries, timeout
4040
tm, ok := metadata.Topics[topic]
4141
if !ok || tm.Error.Code() == confluent.ErrUnknownTopic {
4242
log.Warn("kafka: unknown topic %s, %d retries", topic, retry)
43-
time.Sleep(time.Duration(backoff) * time.Millisecond)
43+
time.Sleep(backoff)
4444
continue
4545
}
4646
if len(tm.Partitions) == 0 {
4747
log.Warn("kafka: 0 partitions returned for %s, %d retries left, %d backoffMs", topic, retry, backoff)
48-
time.Sleep(time.Duration(backoff) * time.Millisecond)
48+
time.Sleep(backoff)
4949
continue
5050
}
5151

0 commit comments

Comments
 (0)