Parcourir la source

Force callers to configure MaxBufferedBytes and MaxBufferTime.

Otherwise people will never remember to not set them to zero.
Burke Libbey il y a 12 ans
Parent
commit
0d48767f72
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      producer.go

+ 5 - 1
producer.go

@@ -86,7 +86,11 @@ func NewProducer(client *Client, config *ProducerConfig) (*Producer, error) {
 	}
 
 	if config.MaxBufferedBytes == 0 {
-		config.MaxBufferedBytes = 1
+		return nil, ConfigurationError("Invalid MaxBufferedBytes")
+	}
+
+	if config.MaxBufferTime == 0 {
+		return nil, ConfigurationError("Invalid MaxBufferTime")
 	}
 
 	return &Producer{