Browse Source

Return last error if can't retry on more hosts (#1213)

* Return last error if can't retry on more hosts
Jaume Marhuenda 7 years ago
parent
commit
2d1883bd2c
1 changed files with 4 additions and 0 deletions
  1. 4 0
      query_executor.go

+ 4 - 0
query_executor.go

@@ -152,6 +152,10 @@ func (q *queryExecutor) run(qry ExecutableQuery, specWG *sync.WaitGroup, results
 			case RetryNextHost:
 				// retry on the next host
 				selectedHost = hostIter()
+				if selectedHost == nil {
+					results <- queryResponse{iter: iter}
+					return
+				}
 				continue
 			default:
 				// Undefined? Return nil and error, this will panic in the requester