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

MaxTries is off by one #54

Closed
buchanae opened this issue Dec 16, 2017 · 2 comments
Closed

MaxTries is off by one #54

buchanae opened this issue Dec 16, 2017 · 2 comments

Comments

@buchanae
Copy link

https://github.com/cenkalti/backoff/blob/master/tries.go#L24

This line should be if b.numTries < b.maxTries {?

@buchanae
Copy link
Author

buchanae commented Dec 16, 2017

I should test code before commenting in public :) This is what I have now:

func (b *backOffTries) NextBackOff() time.Duration {
	if b.maxTries > 0 {
		b.numTries++
		if b.numTries >= b.maxTries {
			return backoff.Stop
		}
	}
	return b.delegate.NextBackOff()
}

@buchanae
Copy link
Author

Oh, silly me, I thought this was different than #52 but after looking again I think it's the same.

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

No branches or pull requests

1 participant