From 35bb120fcf0ed9c31611017624e91e44e941ae02 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 21 May 2023 12:32:31 -0400 Subject: [PATCH] WaitForLeader instead --- cluster/remove.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cluster/remove.go b/cluster/remove.go index 46704ab8..8fbbe2e9 100644 --- a/cluster/remove.go +++ b/cluster/remove.go @@ -8,7 +8,7 @@ import ( // Control is an interface for interacting with a cluster. type Control interface { - LeaderAddr() (string, error) + WaitForLeader(time.Duration) (string, error) WaitForRemoval(string, time.Duration) error } @@ -30,7 +30,7 @@ func NewRemover(client *Client, timeout time.Duration, control Control) *Remover // Do executes the node-removal operation. func (r *Remover) Do(id string, confirm bool) error { - laddr, err := r.control.LeaderAddr() + laddr, err := r.control.WaitForLeader(r.timeout) if err != nil { return err } @@ -38,7 +38,6 @@ func (r *Remover) Do(id string, confirm bool) error { rn := &command.RemoveNodeRequest{ Id: id, } - if err := r.client.RemoveNode(rn, laddr, nil, r.timeout); err != nil { return err }