Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <[email protected]>
  • Loading branch information
HuSharp committed Aug 29, 2023
1 parent 23318b6 commit 6405f53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
5 changes: 2 additions & 3 deletions client/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,14 @@ func (c *baseClient) memberLoop() {
case <-c.checkLeaderCh:
case <-ticker.C:
case <-ctx.Done():
log.Info("[pd.memberLoop] exit memberLoop")
log.Info("[pd] exit member loop")
return
}
failpoint.Inject("skipUpdateMember", func() {
failpoint.Continue()
})

if err := retry.WithBackoff(ctx, c.updateMember, &bo); err != nil {
log.Info("[pd] failed update member with retry", errs.ZapError(err))
log.Error("[pd] failed update member with retry", errs.ZapError(err))
}
}
}
Expand Down
1 change: 0 additions & 1 deletion client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/prometheus/client_golang v1.11.1
github.com/stretchr/testify v1.7.0
go.uber.org/goleak v1.1.11
go.uber.org/multierr v1.7.0
go.uber.org/zap v1.20.0
golang.org/x/text v0.3.8 // indirect
google.golang.org/grpc v1.43.0
Expand Down
7 changes: 2 additions & 5 deletions client/retry/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"time"

"github.com/pingcap/failpoint"
"go.uber.org/multierr"
)

// BackOffer is a backoff policy for retrying operations.
Expand All @@ -35,13 +34,11 @@ func WithBackoff(
fn func() error,
bo *BackOffer,
) error {
var allErrors error
err := fn()
if err != nil {
allErrors = multierr.Append(allErrors, err)
select {
case <-ctx.Done():
return allErrors
return err
case <-time.After(bo.NextBackoff()):
failpoint.Inject("backOffExecute", func() {
testBackOffExecuteFlag = true
Expand All @@ -51,7 +48,7 @@ func WithBackoff(
bo.ResetBackoff()
return nil
}
return allErrors
return err
}

// InitialBackOffer make the initial state for retrying.
Expand Down

0 comments on commit 6405f53

Please sign in to comment.