Skip to content

Commit 1d5a83b

Browse files
authored
fix default fetch.min.bytes to 1, (#565)
following official document. (https://kafka.apache.org/documentation/#fetch.min.bytes)
1 parent 0b1c833 commit 1d5a83b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

reader.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ const (
2424
defaultCommitRetries = 3
2525
)
2626

27+
const (
28+
// defaultFetchMinBytes of 1 byte means that fetch requests are answered as
29+
// soon as a single byte of data is available or the fetch request times out
30+
// waiting for data to arrive.
31+
defaultFetchMinBytes = 1
32+
)
33+
2734
var (
2835
errOnlyAvailableWithGroup = errors.New("unavailable when GroupID is not set")
2936
errNotAvailableWithGroup = errors.New("unavailable when GroupID is set")
@@ -581,7 +588,7 @@ func NewReader(config ReaderConfig) *Reader {
581588
}
582589

583590
if config.MinBytes == 0 {
584-
config.MinBytes = config.MaxBytes
591+
config.MinBytes = defaultFetchMinBytes
585592
}
586593

587594
if config.MaxWait == 0 {

0 commit comments

Comments
 (0)