فهرست منبع

producer: check MaxMessagesPerReq >= FlushMsgCount

Validate the above condition when MaxMessagesPerReq is set, as it doesn't make
sense to force a flush before one has been soft-triggered.
Evan Huus 11 سال پیش
والد
کامیت
dc9dbce604
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      producer.go

+ 2 - 2
producer.go

@@ -75,8 +75,8 @@ func (config *ProducerConfig) Validate() error {
 		Logger.Println("ProducerConfig.MaxMessageBytes too close to MaxRequestSize; it will be ignored.")
 		Logger.Println("ProducerConfig.MaxMessageBytes too close to MaxRequestSize; it will be ignored.")
 	}
 	}
 
 
-	if config.MaxMessagesPerReq < 0 {
-		return ConfigurationError("Invalid MaxMessagesPerReq")
+	if config.MaxMessagesPerReq < 0 || (config.MaxMessagesPerReq > 0 && config.MaxMessagesPerReq < config.FlushMsgCount) {
+		return ConfigurationError("Invalid MaxMessagesPerReq, must be non-negative and >= FlushMsgCount if set")
 	}
 	}
 
 
 	if config.RetryBackoff < 0 {
 	if config.RetryBackoff < 0 {