-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add exponential backoff possibility in case of retries #46
Conversation
772e112
to
93b80fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks great to me, but there are a few typos. Thanks for the feature.
README.md
Outdated
@@ -128,6 +128,12 @@ return errors.Wrap(kafka.ErrNonRetriable, err.Error()) | |||
// This error will also not be retried | |||
return kafka.ErrNonRetriable | |||
``` | |||
|
|||
#### exponential backoff | |||
You can activate it but setting `ExponentialBackoff` config variable as true. You can set this properties as global, you have to use the configuration per-topic. This configuration is useful in case of infinite retry configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo : You can activate it by setting...
README.md
Outdated
|
||
#### exponential backoff | ||
You can activate it but setting `ExponentialBackoff` config variable as true. You can set this properties as global, you have to use the configuration per-topic. This configuration is useful in case of infinite retry configuration. | ||
The exponential backoff algorithm is define like this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo : is defined
listener.go
Outdated
time.Sleep(*handler.Config.DurationBeforeRetry) | ||
if exponentialBackoff { | ||
backoffDuration := calculateExponentialBackoffDuration(retryNumber, handler.Config.DurationBeforeRetry) | ||
Logger.Printf("exponential backoff enable we will retry in %s", backoffDuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo : exponential backoff enabled : we will retry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
This feature could be useful in case of infinite retry. In the case of listener issues, this avoids making too many requests.