Explorar o código

Simplified session.executeQuery to use a pointer to Iter instead of creating a new object.

Phillip Couto %!s(int64=11) %!d(string=hai) anos
pai
achega
093f3395a1
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      session.go

+ 2 - 2
session.go

@@ -90,13 +90,13 @@ func (s *Session) Close() {
 }
 
 func (s *Session) executeQuery(qry *Query) *Iter {
-	itr := &Iter{}
+	var itr *Iter
 	count := 0
 	for count <= qry.rt.NumRetries {
 		conn := s.Node.Pick(nil)
 		//Assign the error unavailable to the iterator
 		if conn == nil {
-			itr.err = ErrUnavailable
+			itr = &Iter{err: ErrUnavailable}
 			break
 		}
 		itr = conn.executeQuery(qry)