Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefer retry.WithPolicy over other retrial methods
- Loading branch information
Showing
6 changed files
with
62 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
package gitter | ||
|
||
import "time" | ||
import ( | ||
"github.com/oklahomer/go-sarah/retry" | ||
"time" | ||
) | ||
|
||
// Config contains some configuration variables for gitter Adapter. | ||
type Config struct { | ||
Token string `json:"token" yaml:"token"` | ||
RetryLimit uint `json:"retry_limit" yaml:"retry_limit"` | ||
RetryInterval time.Duration `json:"retry_interval" yaml:"retry_interval"` | ||
Token string `json:"token" yaml:"token"` | ||
RetryPolicy *retry.Policy `json:"retry_policy" yaml:"retry_policy"` | ||
} | ||
|
||
// NewConfig returns initialized Config struct with default settings. | ||
// Token is empty at this point. Token can be set by feeding this instance to json.Unmarshal/yaml.Unmarshal, | ||
// or direct assignment. | ||
func NewConfig() *Config { | ||
return &Config{ | ||
Token: "", | ||
RetryLimit: 10, | ||
RetryInterval: 500 * time.Millisecond, | ||
Token: "", | ||
RetryPolicy: &retry.Policy{ | ||
Trial: 10, | ||
Interval: 500 * time.Millisecond, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters