Procházet zdrojové kódy

mark the selected host with the real batch response

Thomas Adam před 10 roky
rodič
revize
def9d197ea
1 změnil soubory, kde provedl 7 přidání a 7 odebrání
  1. 7 7
      session.go

+ 7 - 7
session.go

@@ -470,21 +470,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