From aa4a92551c820f9efce99fe8b8de1d736e7abb4f Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Mon, 9 Feb 2026 17:10:14 +0100 Subject: [PATCH] [ignore] fix retry system when publishing cue module Signed-off-by: Augustin Husson --- scripts/cue-publish/cue-publish.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/cue-publish/cue-publish.go b/scripts/cue-publish/cue-publish.go index adec603f..b9c18830 100644 --- a/scripts/cue-publish/cue-publish.go +++ b/scripts/cue-publish/cue-publish.go @@ -65,16 +65,19 @@ func main() { retryMaxAttempts := 10 // Initial sleep duration between retries: random value between 1s and 10s sleepBetweenRetries := (1 + time.Duration(rand.Int64N(9))) * time.Second - for attempt := 1; attempt <= retryMaxAttempts; attempt++ { + doesItFail := true + for attempt := 1; attempt <= retryMaxAttempts && doesItFail; attempt++ { + // Wait for a few seconds immediately before the first attempt to reduce collision risk with other jobs running in parallel. + time.Sleep(sleepBetweenRetries) if err := command.Run("cue", "mod", "publish", version); err != nil { logrus.WithError(err).Warnf("Attempt %d/%d: Error publishing the module, retrying...", attempt, retryMaxAttempts) if attempt == retryMaxAttempts { logrus.Fatal("Max retry attempts reached, failing the publish process") } - // Wait for a few seconds before retrying - time.Sleep(sleepBetweenRetries) // Increase the sleep duration for the next attempt with a random value to reduce collision risk with other jobs running in parallel. sleepBetweenRetries = sleepBetweenRetries + (1+time.Duration(rand.Int64N(19)))*time.Second + } else { + doesItFail = false } } logrus.Infof("CUE module %s published successfully", module)