mirror of https://github.com/status-im/consul.git
Merge pull request #9591 from hashicorp/dnephin/state-store-coordinates-iter
state: do not delete from inside an iteration (coordinates)
This commit is contained in:
parent
5f3a185cb0
commit
7f14ce7a7e
|
@ -740,7 +740,11 @@ func (s *Store) deleteNodeTxn(tx WriteTxn, idx uint64, nodeName string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed coordinate lookup: %s", err)
|
return fmt.Errorf("failed coordinate lookup: %s", err)
|
||||||
}
|
}
|
||||||
|
var coordsToDelete []interface{}
|
||||||
for coord := coords.Next(); coord != nil; coord = coords.Next() {
|
for coord := coords.Next(); coord != nil; coord = coords.Next() {
|
||||||
|
coordsToDelete = append(coordsToDelete, coord)
|
||||||
|
}
|
||||||
|
for _, coord := range coordsToDelete {
|
||||||
if err := tx.Delete("coordinates", coord); err != nil {
|
if err := tx.Delete("coordinates", coord); err != nil {
|
||||||
return fmt.Errorf("failed deleting coordinate: %s", err)
|
return fmt.Errorf("failed deleting coordinate: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue