engine, etcd: Prevent engine thrashing
These two small bugs would allow thrashing to occur since we'd constantly delete and re-add exports, and constantly think that a noop etcd operation made a change.
This commit is contained in:
@@ -236,7 +236,14 @@ func (obj *Exporter) Prune(ctx context.Context, graph *pgraph.Graph) error {
|
|||||||
// If we do this erroneously, it causes extra traffic.
|
// If we do this erroneously, it causes extra traffic.
|
||||||
obj.state[k] = false // do this only if the Res is NEW
|
obj.state[k] = false // do this only if the Res is NEW
|
||||||
continue // skip it, it's staying
|
continue // skip it, it's staying
|
||||||
|
|
||||||
|
} else if exists {
|
||||||
|
// If it exists and it's the same as it was, do nothing.
|
||||||
|
// This is important to prevent thrashing/flapping...
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These don't exist anymore, we have to get rid of them...
|
||||||
delete(obj.state, k) // it's gone!
|
delete(obj.state, k) // it's gone!
|
||||||
resourceDeletes = append(resourceDeletes, &k)
|
resourceDeletes = append(resourceDeletes, &k)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func SetResources(ctx context.Context, client interfaces.Client, hostname string
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
b = b && out.Succeeded // collect the true/false responses...
|
b = b && !out.Succeeded // collect the true/false responses...
|
||||||
}
|
}
|
||||||
|
|
||||||
// false means something changed
|
// false means something changed
|
||||||
|
|||||||
Reference in New Issue
Block a user