Skip to content

Commit

Permalink
feat: allow disabling sink retries
Browse files Browse the repository at this point in the history
If 0 retry is specified via configuration file, do not override it with
default of 5. Only if the configuration is skipped, default to 5.

Example 1 - meteor.yml:

    LOG_LEVEL: info
    MAX_RETRIES: 5

retries = 5.

Example 2 - meteor.yml:

    LOG_LEVEL: info
    MAX_RETRIES: 0

retries = 0.

Example 3 - meteor.yml:

    LOG_LEVEL: info

retries = 5.
  • Loading branch information
sudo-suhas committed Aug 25, 2022
1 parent 7cc0500 commit 35bae5f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions agent/retrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
)

const (
defaultMaxRetries = 5
defaultInitialInterval = 5 * time.Second
)

Expand All @@ -19,18 +18,16 @@ type retrier struct {
}

func newRetrier(maxRetries int, initialInterval time.Duration) *retrier {
r := new(retrier)

r.maxRetries = maxRetries
if r.maxRetries == 0 {
r.maxRetries = defaultMaxRetries
r := retrier{
maxRetries: maxRetries,
initialInterval: initialInterval,
}
r.initialInterval = initialInterval

if r.initialInterval == 0 {
r.initialInterval = defaultInitialInterval
}

return r
return &r
}

func (r *retrier) retry(operation func() error, notify func(e error, d time.Duration)) error {
Expand Down

0 comments on commit 35bae5f

Please sign in to comment.