Browse Source

Moved select statement to end of loop

Zach Badgett 10 years ago
parent
commit
cbbe27dcd4
1 changed files with 5 additions and 4 deletions
  1. 5 4
      host_source.go

+ 5 - 4
host_source.go

@@ -97,10 +97,6 @@ func (h *ringDescriber) run(sleep time.Duration) {
 	}
 	}
 
 
 	for {
 	for {
-		select {
-		case <-h.closeChan:
-			return
-		}
 		// if we have 0 hosts this will return the previous list of hosts to
 		// if we have 0 hosts this will return the previous list of hosts to
 		// attempt to reconnect to the cluster otherwise we would never find
 		// attempt to reconnect to the cluster otherwise we would never find
 		// downed hosts again, could possibly have an optimisation to only
 		// downed hosts again, could possibly have an optimisation to only
@@ -116,5 +112,10 @@ func (h *ringDescriber) run(sleep time.Duration) {
 		}
 		}
 
 
 		time.Sleep(sleep)
 		time.Sleep(sleep)
+
+		select {
+		case <-h.closeChan:
+			return
+		}
 	}
 	}
 }
 }