mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tcpproxy: don't use range variable in reactivate goroutine
Ends up trying to reactivate only the last endpoint.
This commit is contained in:
parent
4e114d3549
commit
8b097f279d
@ -147,16 +147,17 @@ func (tp *TCPProxy) runMonitor() {
|
|||||||
select {
|
select {
|
||||||
case <-time.After(tp.MonitorInterval):
|
case <-time.After(tp.MonitorInterval):
|
||||||
tp.mu.Lock()
|
tp.mu.Lock()
|
||||||
for _, r := range tp.remotes {
|
for _, rem := range tp.remotes {
|
||||||
if !r.isActive() {
|
if rem.isActive() {
|
||||||
go func() {
|
continue
|
||||||
if err := r.tryReactivate(); err != nil {
|
|
||||||
plog.Warningf("failed to activate endpoint [%s] due to %v (stay inactive for another %v)", r.addr, err, tp.MonitorInterval)
|
|
||||||
} else {
|
|
||||||
plog.Printf("activated %s", r.addr)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
go func(r *remote) {
|
||||||
|
if err := r.tryReactivate(); err != nil {
|
||||||
|
plog.Warningf("failed to activate endpoint [%s] due to %v (stay inactive for another %v)", r.addr, err, tp.MonitorInterval)
|
||||||
|
} else {
|
||||||
|
plog.Printf("activated %s", r.addr)
|
||||||
|
}
|
||||||
|
}(rem)
|
||||||
}
|
}
|
||||||
tp.mu.Unlock()
|
tp.mu.Unlock()
|
||||||
case <-tp.donec:
|
case <-tp.donec:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user