check predecessor before stabilizing
This commit is contained in:
parent
4c79714fcd
commit
6316576823
@ -55,6 +55,7 @@ func (n *Node) Router() http.Handler {
|
|||||||
// Check performs checks that implement the Chord protocol.
|
// Check performs checks that implement the Chord protocol.
|
||||||
// It must be called periodically while the node is alive.
|
// It must be called periodically while the node is alive.
|
||||||
func (n *Node) Check(ctx context.Context) error {
|
func (n *Node) Check(ctx context.Context) error {
|
||||||
|
chord.CheckPredecessor(ctx, n.client, n.self)
|
||||||
if err := chord.Stabilize(ctx, n.client, n.self); err != nil {
|
if err := chord.Stabilize(ctx, n.client, n.self); err != nil {
|
||||||
return fmt.Errorf("failed to stabilize: %w", err)
|
return fmt.Errorf("failed to stabilize: %w", err)
|
||||||
}
|
}
|
||||||
@ -62,7 +63,6 @@ func (n *Node) Check(ctx context.Context) error {
|
|||||||
// if err := chord.FixFingers(ctx, n.client, n.self); err != nil {
|
// if err := chord.FixFingers(ctx, n.client, n.self); err != nil {
|
||||||
// return fmt.Errorf("failed to fix fingers: %w", err)
|
// return fmt.Errorf("failed to fix fingers: %w", err)
|
||||||
// }
|
// }
|
||||||
chord.CheckPredecessor(ctx, n.client, n.self)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user