Просмотр исходного кода

Force callers to configure MaxBufferedBytes and MaxBufferTime.

Otherwise people will never remember to not set them to zero.
Burke Libbey 12 лет назад
Родитель
Сommit
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{