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

Make backoff.duration available until the first next call. #31

Merged
merged 4 commits into from
Sep 25, 2020

Conversation

yowu
Copy link
Contributor

@yowu yowu commented Sep 21, 2020

This PR is attempt to fix the issue reported by issue #30.
The basic idea is to make sure duration call must be called after the first next call. This will make sure DelegateBackoff and ExponentialBackoff could be initialized properly based on the input.

@yowu yowu changed the title Make backoff.duration avaiable until the first next call. Make backoff.duration available until the first next call. Sep 21, 2020
@yowu
Copy link
Contributor Author

yowu commented Sep 23, 2020

@connor4312, any comments?

@connor4312
Copy link
Owner

I put in some changes to make the backoff factory separate from the backoff instance. I always prefer to try to use the type system to make it 'impossible' to write incorrect code or code that throws at runtime, doing it in this way enforces that duration() can't be accessed before the backoff is created in context the first time.

Let me know what you think.

@yowu
Copy link
Contributor Author

yowu commented Sep 25, 2020

The idea of "making the backoff factory separate from the backoff instance" is more clear! Good job!

@connor4312
Copy link
Owner

Cool. I'll get this merged. This is a breaking change, so it will be a major version bump

@connor4312 connor4312 merged commit 657be03 into connor4312:master Sep 25, 2020
@yowu yowu deleted the retry-backoff branch November 16, 2021 05:37
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 this pull request may close these issues.

3 participants