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 support to customize the RetryHydrate function #358

Merged
merged 12 commits into from
Nov 7, 2022

Conversation

Subhajit97
Copy link
Contributor

type RetryConfig struct {
	ShouldRetryErrorFunc ErrorPredicateWithContext
	// deprecated use ShouldRetryErrorFunc
	ShouldRetryError ErrorPredicate

	// Maximum number of retry operation to be performed. Default set to 10.
	MaxAttempts int64
	// Algorithm for the backoff. Supported values: Fibonacci, Exponential, and Constant. Default set to Fibonacci.
	BackoffAlgorithm string
	// Starting interval. Default set to 100ms.
	RetryInterval int64
	// Set a maximum on the duration (in ms) returned from the next backoff.
	CappedDuration int64
	// Sets a maximum on the total amount of time (in ms) a backoff should execute.
	MaxDuration int64
}

@Subhajit97 Subhajit97 self-assigned this Jul 12, 2022
@Subhajit97 Subhajit97 linked an issue Jul 12, 2022 that may be closed by this pull request
plugin/hydrate_error.go Show resolved Hide resolved
func getBackoff(retryConfig *RetryConfig) (retry.Backoff, error) {
// Default set to Fibonacci
backoffAlgorithm := "Fibonacci"
retryInterval := time.Duration(100) // in ms
Copy link
Contributor

Choose a reason for hiding this comment

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

you could always rephrase this to

retryInterval := 100 * time.Millisecond

to avoid the need for a comment

@kaidaguerre kaidaguerre merged commit 7490c6a into main Nov 7, 2022
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.

Add ability to customize the RetryHydrate function
2 participants