mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 06:16:08 +00:00
agent/consul: change provider wait from goto to a loop
This commit is contained in:
parent
c8b65217c3
commit
bc605a1576
@ -489,10 +489,10 @@ func (s *Server) createCAProvider(conf *structs.CAConfiguration) (connect.CAProv
|
|||||||
|
|
||||||
func (s *Server) getCAProvider() connect.CAProvider {
|
func (s *Server) getCAProvider() connect.CAProvider {
|
||||||
retries := 0
|
retries := 0
|
||||||
|
var result connect.CAProvider
|
||||||
RETRY_PROVIDER:
|
for result == nil {
|
||||||
s.caProviderLock.RLock()
|
s.caProviderLock.RLock()
|
||||||
result := s.caProvider
|
result = s.caProvider
|
||||||
s.caProviderLock.RUnlock()
|
s.caProviderLock.RUnlock()
|
||||||
|
|
||||||
// In cases where an agent is started with managed proxies, we may ask
|
// In cases where an agent is started with managed proxies, we may ask
|
||||||
@ -501,7 +501,10 @@ RETRY_PROVIDER:
|
|||||||
if result == nil && s.IsLeader() && retries < 10 {
|
if result == nil && s.IsLeader() && retries < 10 {
|
||||||
retries++
|
retries++
|
||||||
time.Sleep(50 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
goto RETRY_PROVIDER
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user