diff --git a/lib/kafkalib/writer.go b/lib/kafkalib/writer.go index 1b94dfd5..a883cc0b 100644 --- a/lib/kafkalib/writer.go +++ b/lib/kafkalib/writer.go @@ -1,6 +1,7 @@ package kafkalib import ( + "cmp" "context" "encoding/json" "fmt" @@ -32,10 +33,7 @@ func newWriter(ctx context.Context, cfg config.Kafka) (*kafka.Writer, error) { Compression: kafka.Gzip, Transport: transport, WriteTimeout: 5 * time.Second, - } - - if cfg.MaxRequestSize > 0 { - writer.BatchBytes = int64(cfg.MaxRequestSize) + BatchBytes: cmp.Or(int64(cfg.MaxRequestSize), 1048576), } return writer, nil