Browse Source

update attempts

Chris Bannister 10 years ago
parent
commit
bec525bec1
1 changed files with 3 additions and 2 deletions
  1. 3 2
      session.go

+ 3 - 2
session.go

@@ -272,6 +272,7 @@ func (s *Session) executeQuery(qry *Query) *Iter {
 	for {
 		host, conn := s.pool.Pick(qry)
 
+		qry.attempts++
 		//Assign the error unavailable to the iterator
 		if conn == nil {
 			if qry.rt == nil || !qry.rt.Attempt(qry) {
@@ -285,11 +286,11 @@ func (s *Session) executeQuery(qry *Query) *Iter {
 		t := time.Now()
 		iter = conn.executeQuery(qry)
 		qry.totalLatency += time.Now().Sub(t).Nanoseconds()
-		qry.attempts++
 
 		//Exit for loop if the query was successful
 		if iter.err == nil {
-			host.Mark(iter.err)
+			iter.host = conn.host
+			host.Mark(nil)
 			break
 		}