feat: backoff config initial func

This commit is contained in:
Mmx
2024-09-24 23:18:42 +08:00
parent f82deb2870
commit e1ff68cfc2
3 changed files with 36 additions and 2 deletions

View 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,
}
}