-
Notifications
You must be signed in to change notification settings - Fork 20
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
Allow configuring max retries #84
Conversation
gbus/abstractions.go
Outdated
@@ -166,6 +166,9 @@ type Builder interface { | |||
//ConfigureHealthCheck defines the default timeout in seconds for the db ping check | |||
ConfigureHealthCheck(timeoutInSeconds time.Duration) Builder | |||
|
|||
//RetriesNum defines the number of retries upon error | |||
RetriesNum(retries uint) Builder |
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.
As there are going to be more configuration options that are currently hard coded but moving forward we would like to provide a way to configure I think we would probably be better off have one WithConfiguration(ConfigObject) that we can use to place on it additional config options moving forward.
WDYT ?
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.
sounds good !
gbus/builder/builder.go
Outdated
@@ -170,6 +170,11 @@ func (builder *defaultBuilder) ConfigureHealthCheck(timeoutInSeconds time.Durati | |||
return builder | |||
} | |||
|
|||
func (builder *defaultBuilder) RetriesNum(retries uint) gbus.Builder { | |||
gbus.MaxRetryCount = retries |
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.
should guard against zero and negative values
gbus/builder/builder.go
Outdated
@@ -170,6 +170,11 @@ func (builder *defaultBuilder) ConfigureHealthCheck(timeoutInSeconds time.Durati | |||
return builder | |||
} | |||
|
|||
func (builder *defaultBuilder) RetriesNum(retries uint) gbus.Builder { | |||
gbus.MaxRetryCount = retries |
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.
gbus.MaxRetryCount = retries | |
if retries > 0 { | |
gbus.MaxRetryCount = retries | |
} |
gbus/worker.go
Outdated
return retry.Retry(action, | ||
strategy.Limit(MaxRetryCount), | ||
strategy.Backoff(backoff.Fibonacci(50*time.Millisecond))) | ||
strategy.BackoffWithJitter( | ||
backoff.BinaryExponential(10*time.Millisecond), |
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.
lets have these values exposed via configuration with default values
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.
just the 10*time.Millisecond
, right?
gbus/abstractions.go
Outdated
@@ -15,6 +15,12 @@ const ( | |||
EVT Semantics = "evt" | |||
) | |||
|
|||
//ConfigObject provides configuration passed to the bus builder | |||
type ConfigObject struct { |
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.
Please rename to BusConfiguration
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.
Nice job @avigailberger !!
retries
Provide a way to externally configure the maximum amount of retries handlers get executed before declaring the message as poison and rejecting it
Closes #35