Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry.Context suppresses error attempt log #51

Closed
56KBs opened this issue Nov 12, 2021 · 0 comments · Fixed by #53
Closed

retry.Context suppresses error attempt log #51

56KBs opened this issue Nov 12, 2021 · 0 comments · Fixed by #53

Comments

@56KBs
Copy link
Contributor

56KBs commented Nov 12, 2021

When using retry.Context that hits the deadline, the only error returned is context deadline exceeded, suppressing all errors from the attempts made.

Example

func main() {
	ctx, cancelCtx := context.WithTimeout(context.Background(), 1*time.Second)
	defer cancelCtx()
	err := retry.Do(
		func() error {
			return errors.New("error")
		},
		retry.Context(ctx),
	)
	fmt.Println(err)
}

Actual Output

context deadline exceeded

Expected Output

All attempts fail:
#1: context deadline exceeded
#2: error
#3: error
#4: error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant