feat: backoff config initial func
This commit is contained in:
22
internal/config/backoff.go
Normal file
22
internal/config/backoff.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/Mmx233/BackoffCli/backoff"
|
||||
"time"
|
||||
)
|
||||
|
||||
var BackoffConfig backoff.Conf
|
||||
|
||||
func initBackoff() {
|
||||
setting := Settings.Guardian.Backoff
|
||||
BackoffConfig = backoff.Conf{
|
||||
Logger: Logger,
|
||||
DisableRecovery: true,
|
||||
InitialDuration: time.Duration(setting.InitialDuration) * time.Second,
|
||||
MaxDuration: time.Duration(setting.MaxDuration) * time.Second,
|
||||
MaxRetry: setting.MaxRetries,
|
||||
ExponentFactor: int(setting.ExponentFactor),
|
||||
InterConstFactor: time.Duration(setting.InterConstFactor) * time.Second,
|
||||
OuterConstFactor: time.Duration(setting.OuterConstFactor) * time.Second,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user