wrap stabilization errors
This commit is contained in:
parent
7a04a22f76
commit
8e73402c58
@ -88,14 +88,17 @@ func Stabilize(ctx context.Context, cl Client, n *Node) error {
|
||||
pred, _, err := cl.Neighbors(ctx, n.Successor())
|
||||
if err != nil {
|
||||
// TODO(zeph): replication
|
||||
return err
|
||||
return fmt.Errorf("acquiring successor neighbors for stabilization: %w", err)
|
||||
}
|
||||
if pred.IsValid() && contains(n.self.id, n.Successor().id, pred.id) && pred.id != n.Successor().id {
|
||||
// Shift in the new successor.
|
||||
copy(n.succ[1:], n.succ)
|
||||
n.succ[0] = pred
|
||||
}
|
||||
return cl.Notify(ctx, n, n.Successor())
|
||||
if err := cl.Notify(ctx, n, n.Successor()); err != nil {
|
||||
return fmt.Errorf("notifying successor: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Notify informs n that p considers n to be p's successor.
|
||||
|
Loading…
Reference in New Issue
Block a user