소스 검색

Moved select statement to end of loop

Zach Badgett 10 년 전
부모
커밋
cbbe27dcd4
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      host_source.go

+ 5 - 4
host_source.go

@@ -97,10 +97,6 @@ func (h *ringDescriber) run(sleep time.Duration) {
 	}
 
 	for {
-		select {
-		case <-h.closeChan:
-			return
-		}
 		// 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
 		// downed hosts again, could possibly have an optimisation to only
@@ -116,5 +112,10 @@ func (h *ringDescriber) run(sleep time.Duration) {
 		}
 
 		time.Sleep(sleep)
+
+		select {
+		case <-h.closeChan:
+			return
+		}
 	}
 }