Skip to content

Commit

Permalink
fix: DoValue example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Jun 25, 2024
1 parent 401e1df commit d917f5c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ var policy = retry.Policy{
}

func DoSomethingWithRetry(ctx context.Context) (Result, error) {
retrier := policy.Start(ctx)
for retrier.Continue() {
if res, err := DoSomething(ctx); err == nil {
return res, nil
}
}
return 0, errors.New("tried very hard, but no luck")
return retry.DoValue(ctx, policy, DoSomething)
}

func main() {
Expand Down

0 comments on commit d917f5c

Please sign in to comment.