From f7296de183a1a2f9f29bf1d3047983fc9b976cc3 Mon Sep 17 00:00:00 2001 From: Benjamin Edwards Date: Fri, 4 Aug 2023 17:50:03 -0400 Subject: [PATCH] expose env var for orbit enrollment retry interval (#12991) --- server/service/orbit_client.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 +}