Преглед на файлове

Force callers to configure MaxBufferedBytes and MaxBufferTime.

Otherwise people will never remember to not set them to zero.
Burke Libbey преди 12 години
родител
ревизия
0d48767f72
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  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{