Browse Source

Force callers to configure MaxBufferedBytes and MaxBufferTime.

Otherwise people will never remember to not set them to zero.
Burke Libbey 12 years ago
parent
commit
0d48767f72
1 changed files with 5 additions and 1 deletions
  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{