From 5ae6aa3b581842edf2a228647f34d353ad482967 Mon Sep 17 00:00:00 2001 From: jo Date: Thu, 25 Jul 2024 17:28:20 +0200 Subject: [PATCH 1/2] feat: truncate poll exponential backoff function to max 5s Related to #346 and #380 --- internal/app/app.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/app/app.go b/internal/app/app.go index 075515e5..7bdd85a6 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -149,7 +149,11 @@ func CreateHcloudClient(metricsRegistry *prometheus.Registry, logger log.Logger) } opts = append(opts, hcloud.WithPollOpts(hcloud.PollOpts{ - BackoffFunc: hcloud.ExponentialBackoff(2, time.Duration(pollingInterval)*time.Second), + BackoffFunc: hcloud.ExponentialBackoffWithOpts(hcloud.ExponentialBackoffOpts{ + Base: time.Duration(pollingInterval) * time.Second, + Multiplier: 2, + Cap: 5 * time.Second, + }), })) return hcloud.NewClient(opts...), nil From 6f80195f6ea55aeaf1e1790610be3bfd3f085753 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 26 Jul 2024 15:08:03 +0200 Subject: [PATCH 2/2] cap to 10s --- internal/app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/app.go b/internal/app/app.go index 7bdd85a6..75b696ab 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -152,7 +152,7 @@ func CreateHcloudClient(metricsRegistry *prometheus.Registry, logger log.Logger) BackoffFunc: hcloud.ExponentialBackoffWithOpts(hcloud.ExponentialBackoffOpts{ Base: time.Duration(pollingInterval) * time.Second, Multiplier: 2, - Cap: 5 * time.Second, + Cap: 10 * time.Second, }), }))