Ignore err when delete a NotFound backend
1. move getBackendsForIGs() out of a cycle 2. add() should return nil at last 3. do not return err when delete a notFound backend
This commit is contained in:
parent
e2c7a536e9
commit
6524824406
1 changed files with 4 additions and 3 deletions
|
@ -159,8 +159,8 @@ func (b *Backends) create(igs []*compute.InstanceGroup, namedPort *compute.Named
|
||||||
// which wraps a HTTP 400 status code. We handle it in the loop below
|
// which wraps a HTTP 400 status code. We handle it in the loop below
|
||||||
// and come around to retry with the right balancing mode. The goal is to
|
// and come around to retry with the right balancing mode. The goal is to
|
||||||
// switch everyone to using RATE.
|
// switch everyone to using RATE.
|
||||||
|
backends := getBackendsForIGs(igs)
|
||||||
for _, bm := range []BalancingMode{Rate, Utilization} {
|
for _, bm := range []BalancingMode{Rate, Utilization} {
|
||||||
backends := getBackendsForIGs(igs)
|
|
||||||
for _, b := range backends {
|
for _, b := range backends {
|
||||||
switch bm {
|
switch bm {
|
||||||
case Rate:
|
case Rate:
|
||||||
|
@ -224,7 +224,7 @@ func (b *Backends) Add(port int64) error {
|
||||||
if err := b.edgeHop(be, igs); err != nil {
|
if err := b.edgeHop(be, igs); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete deletes the Backend for the given port.
|
// Delete deletes the Backend for the given port.
|
||||||
|
@ -334,7 +334,8 @@ func (b *Backends) GC(svcNodePorts []int64) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
glog.V(3).Infof("GCing backend for port %v", p)
|
glog.V(3).Infof("GCing backend for port %v", p)
|
||||||
if err := b.Delete(nodePort); err != nil {
|
if err := b.Delete(nodePort); err != nil &&
|
||||||
|
!utils.IsHTTPErrorCode(err, http.StatusNotFound) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue