|
|
|
@ -79,7 +79,7 @@ func New(c *Config, logger log.Logger) *Discovery { |
|
|
|
|
if !ok { |
|
|
|
|
panic("Discovery watch self failed") |
|
|
|
|
} |
|
|
|
|
discoveryIns, ok := r.Fetch(context.Background()) |
|
|
|
|
discoveryIns, ok := r.fetch(context.Background()) |
|
|
|
|
if ok { |
|
|
|
|
d.newSelf(discoveryIns.Instances) |
|
|
|
|
} |
|
|
|
@ -105,7 +105,7 @@ func (d *Discovery) selfProc(resolver *Resolve, event <-chan struct{}) { |
|
|
|
|
if !ok { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
zones, ok := resolver.Fetch(context.Background()) |
|
|
|
|
zones, ok := resolver.fetch(context.Background()) |
|
|
|
|
if ok { |
|
|
|
|
d.newSelf(zones.Instances) |
|
|
|
|
} |
|
|
|
@ -444,8 +444,8 @@ func (r *Resolve) Watch() <-chan struct{} { |
|
|
|
|
return r.event |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Fetch resolver instance.
|
|
|
|
|
func (r *Resolve) Fetch(ctx context.Context) (ins *disInstancesInfo, ok bool) { |
|
|
|
|
// fetch resolver instance.
|
|
|
|
|
func (r *Resolve) fetch(ctx context.Context) (ins *disInstancesInfo, ok bool) { |
|
|
|
|
r.d.mutex.RLock() |
|
|
|
|
app, ok := r.d.apps[r.id] |
|
|
|
|
r.d.mutex.RUnlock() |
|
|
|
|