فهرست منبع

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{