diff --git a/server/service/orbit_client.go b/server/service/orbit_client.go index 5867c85066d2..057911c6059f 100644 --- a/server/service/orbit_client.go +++ b/server/service/orbit_client.go @@ -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 +}