Kaynağa Gözat

Merge pull request #5471 from xiang90/proxy_rand

httpproxy: init the rand that we use to randomize endpoints
Xiang Li 10 yıl önce
ebeveyn
işleme
2d47211589
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  1. 4 0
      proxy/httpproxy/director.go

+ 4 - 0
proxy/httpproxy/director.go

@@ -27,6 +27,10 @@ const defaultRefreshInterval = 30000 * time.Millisecond
 
 var once sync.Once
 
+func init() {
+	rand.Seed(time.Now().UnixNano())
+}
+
 func newDirector(urlsFunc GetProxyURLs, failureWait time.Duration, refreshInterval time.Duration) *director {
 	d := &director{
 		uf:          urlsFunc,