فهرست منبع

Add a config warning for unusual flushes

In Producer.Flush, if Bytes or Messages is set but Frequency is not then
messages may not get flushed because Sarama will wait forever to fulfill
the Byte/Message configurations.
Evan Huus 9 سال پیش
والد
کامیت
686609495c
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      config.go

+ 3 - 0
config.go

@@ -310,6 +310,9 @@ func (c *Config) Validate() error {
 	if c.Producer.Flush.Bytes >= int(MaxRequestSize) {
 		Logger.Println("Producer.Flush.Bytes must be smaller than MaxRequestSize; it will be ignored.")
 	}
+	if (c.Producer.Flush.Bytes > 0 || c.Producer.Flush.Messages > 0) && c.Producer.Flush.Frequency == 0 {
+		Logger.Println("Producer.Flush: Bytes or Messages are set, but Frequency is not; messages may not get flushed.")
+	}
 	if c.Producer.Timeout%time.Millisecond != 0 {
 		Logger.Println("Producer.Timeout only supports millisecond resolution; nanoseconds will be truncated.")
 	}