expose env var for orbit enrollment retry interval (#12991)
This commit is contained in:
@@ -202,7 +202,7 @@ func (oc *OrbitClient) getNodeKeyOrEnroll() (string, error) {
|
||||
return err
|
||||
}
|
||||
},
|
||||
retry.WithInterval(constant.OrbitEnrollRetrySleep),
|
||||
retry.WithInterval(OrbitRetryInterval()),
|
||||
retry.WithMaxAttempts(constant.OrbitEnrollMaxRetries),
|
||||
); err != nil {
|
||||
return "", fmt.Errorf("orbit node key enroll failed, attempts=%d", constant.OrbitEnrollMaxRetries)
|
||||
@@ -292,3 +292,14 @@ func (oc *OrbitClient) setLastRecordedError(err error) {
|
||||
|
||||
oc.lastRecordedErr = fmt.Errorf("%s: %w", time.Now().UTC().Format("2006-01-02T15:04:05Z"), err)
|
||||
}
|
||||
|
||||
func OrbitRetryInterval() time.Duration {
|
||||
interval := os.Getenv("FLEETD_ENROLL_RETRY_INTERVAL")
|
||||
if interval != "" {
|
||||
d, err := time.ParseDuration(interval)
|
||||
if err == nil {
|
||||
return d
|
||||
}
|
||||
}
|
||||
return constant.OrbitEnrollRetrySleep
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user