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

Allow configuring max retries #84

Merged
merged 5 commits into from
Jun 8, 2019
Merged

Conversation

avigailberger
Copy link
Contributor

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

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

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good !

@@ -170,6 +170,11 @@ func (builder *defaultBuilder) ConfigureHealthCheck(timeoutInSeconds time.Durati
return builder
}

func (builder *defaultBuilder) RetriesNum(retries uint) gbus.Builder {
gbus.MaxRetryCount = retries
Copy link
Contributor

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

@@ -170,6 +170,11 @@ func (builder *defaultBuilder) ConfigureHealthCheck(timeoutInSeconds time.Durati
return builder
}

func (builder *defaultBuilder) RetriesNum(retries uint) gbus.Builder {
gbus.MaxRetryCount = retries
Copy link
Contributor

Choose a reason for hiding this comment

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

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

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

Copy link
Contributor Author

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?

@coveralls
Copy link

coveralls commented Jun 5, 2019

Coverage Status

Coverage increased (+0.3%) to 73.511% when pulling 4c2becb on allow-configuring-max-retries into 382bf3f on v1.x.

@@ -15,6 +15,12 @@ const (
EVT Semantics = "evt"
)

//ConfigObject provides configuration passed to the bus builder
type ConfigObject struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename to BusConfiguration

Copy link
Contributor

@rhinof rhinof left a comment

Choose a reason for hiding this comment

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

Nice job @avigailberger !!

@rhinof rhinof merged commit 8c8ebbe into v1.x Jun 8, 2019
@rhinof rhinof deleted the allow-configuring-max-retries branch July 4, 2019 16:57
@rhinof rhinof added the enhancement New feature or request label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants