Browse Source

Checking Reset()'s active return value is racy according to Golang docs. Docs advice to call Stop inorder to reuse a timer. Should fix #732.

Nimi Wariboko Jr 9 years ago
parent
commit
779ef6ae4e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      consumer.go

+ 2 - 1
consumer.go

@@ -420,10 +420,11 @@ feederLoop:
 		msgs, child.responseResult = child.parseResponse(response)
 		msgs, child.responseResult = child.parseResponse(response)
 
 
 		for i, msg := range msgs {
 		for i, msg := range msgs {
-			if !expiryTimer.Reset(child.conf.Consumer.MaxProcessingTime) {
+			if !expiryTimer.Stop() {
 				// expiryTimer was expired; clear out the waiting msg
 				// expiryTimer was expired; clear out the waiting msg
 				<-expiryTimer.C
 				<-expiryTimer.C
 			}
 			}
+			expiryTimer.Reset(child.conf.Consumer.MaxProcessingTime)
 
 
 			select {
 			select {
 			case child.messages <- msg:
 			case child.messages <- msg: