Browse Source

Merge pull request #254 from Shopify/timeout-wait-for-all

Require a non-zero timeout when WaitForAll
Evan Huus 10 years ago
parent
commit
81edb5fed8
1 changed files with 4 additions and 0 deletions
  1. 4 0
      producer.go

+ 4 - 0
producer.go

@@ -53,6 +53,10 @@ func (config *ProducerConfig) Validate() error {
 		Logger.Println("ProducerConfig.Timeout only supports millisecond resolution; nanoseconds will be truncated.")
 	}
 
+	if config.RequiredAcks == WaitForAll && config.Timeout == 0 {
+		return ConfigurationError("If you WaitForAll you must specify a non-zero timeout to wait.")
+	}
+
 	if config.FlushMsgCount < 0 {
 		return ConfigurationError("Invalid FlushMsgCount")
 	}