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

Docs can be improved a lot #43

Open
Xuanwo opened this issue Feb 9, 2023 · 0 comments
Open

Docs can be improved a lot #43

Xuanwo opened this issue Feb 9, 2023 · 0 comments

Comments

@Xuanwo
Copy link
Owner

Xuanwo commented Feb 9, 2023

From reddit:

Does ExponentialBackoff's max_times and max_delay meets your need?

No.

First, the documentation could be better. "If max times is reaching" is unclear and ungrammatical. I might say "Backoff will return Some at most max_times times."

Second, what I'd want is an absolute deadline, and stopping early if the next sleep won't finish until after then. Same idea with the budget: I want a per-attempt check I want to do before the sleep, or a fallible callback to do the sleep. I could do this myself by using the Backoff as an Iterator, but then I don't get the slickness of the Retryable/BlockingRetryable traits.

backon support this feature by accepting a function notify

Oh, I missed that too, sorry! The doc could be better here too though. I might say "registers a notification to be called before waiting for a next attempt"; name the callback's parameters as previous_error and sleep_time, respectively; and amend the log message in the example to will retry after {dur:?} due to error: {err:?}". Could even have the arguments in a struct to allow adding more stuff there without callbacks needing to see stuff they're not interested in (e.g., could add attempt count).

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