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

Add exponential backoff possibility in case of retries #46

Merged
merged 7 commits into from
Jan 6, 2025

Conversation

ErwanVP
Copy link
Collaborator

@ErwanVP ErwanVP commented Dec 26, 2024

This feature could be useful in case of infinite retry. In the case of listener issues, this avoids making too many requests.

@ErwanVP ErwanVP requested review from EdouardBavoux and EtienneGuerlais and removed request for EdouardBavoux December 26, 2024 11:07
@ErwanVP ErwanVP force-pushed the add_exponential_backoff branch from 772e112 to 93b80fd Compare December 26, 2024 13:23
Copy link
Contributor

@EdouardBavoux EdouardBavoux left a 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.
Copy link
Contributor

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.
Copy link
Contributor

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)
Copy link
Contributor

@EdouardBavoux EdouardBavoux Dec 30, 2024

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

Copy link
Contributor

@EdouardBavoux EdouardBavoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@ErwanVP ErwanVP merged commit c1b5542 into master Jan 6, 2025
1 check passed
@ErwanVP ErwanVP deleted the add_exponential_backoff branch January 6, 2025 10:38
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.

2 participants