Kaynağa Gözat

Don't let the caller pass in MaxWaitTime=0.

This mistake is far too easy to make, and rather harmful.
Burke Libbey 12 yıl önce
ebeveyn
işleme
8c2c1f53d4
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      consumer.go

+ 1 - 1
consumer.go

@@ -89,7 +89,7 @@ func NewConsumer(client *Client, topic string, partition int32, group string, co
 		return nil, ConfigurationError("Invalid MaxMessageSize")
 		return nil, ConfigurationError("Invalid MaxMessageSize")
 	}
 	}
 
 
-	if config.MaxWaitTime < 0 {
+	if config.MaxWaitTime <= 0 {
 		return nil, ConfigurationError("Invalid MaxWaitTime")
 		return nil, ConfigurationError("Invalid MaxWaitTime")
 	} else if config.MaxWaitTime < 100 {
 	} else if config.MaxWaitTime < 100 {
 		Logger.Println("ConsumerConfig.MaxWaitTime is very low, which can cause high CPU and network usage. See documentation for details.")
 		Logger.Println("ConsumerConfig.MaxWaitTime is very low, which can cause high CPU and network usage. See documentation for details.")