Prechádzať zdrojové kódy

Merge pull request #589 from lovoo/bugfix/host-mark

mark the selected host with the real batch response
Chris Bannister 10 rokov pred
rodič
commit
2fc8e5b921
1 zmenil súbory, kde vykonal 7 pridanie a 7 odobranie
  1. 7 7
      session.go

+ 7 - 7
session.go

@@ -481,21 +481,21 @@ func (s *Session) executeBatch(batch *Batch) (*Iter, error) {
 		iter, err = conn.executeBatch(batch)
 		batch.totalLatency += time.Now().Sub(t).Nanoseconds()
 		batch.attempts++
-		//Exit loop if operation executed correctly
+
+		// Update host
+		host.Mark(err)
+
+		// Exit loop if operation executed correctly
 		if err == nil {
-			host.Mark(err)
-			return iter, err
+			break
 		}
 
-		// Mark host as OK
-		host.Mark(nil)
-
 		if batch.rt == nil || !batch.rt.Attempt(batch) {
 			break
 		}
 	}
 
-	return nil, err
+	return iter, err
 }
 
 // ExecuteBatch executes a batch operation and returns nil if successful