From 8d7b9f129188b788c5f7c83841c3c4d3efde999b Mon Sep 17 00:00:00 2001 From: Marcos Filipe Date: Fri, 24 Apr 2026 11:48:25 -0300 Subject: [PATCH] fix: mark 3xx/4xx as non-retryable in ListProjects --- api/client/projects_v1_alpha.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/client/projects_v1_alpha.go b/api/client/projects_v1_alpha.go index 217b599..6002668 100644 --- a/api/client/projects_v1_alpha.go +++ b/api/client/projects_v1_alpha.go @@ -59,7 +59,11 @@ func (c *ProjectApiV1AlphaApi) ListProjects() (*models.ProjectListV1Alpha, error return fmt.Errorf("connecting to Semaphore failed '%s'", err) } if status != http.StatusOK { - return fmt.Errorf("http status %d with message \"%s\" received from upstream", status, string(bodyBytes)) + httpErr := fmt.Errorf("http status %d with message \"%s\" received from upstream", status, string(bodyBytes)) + if status >= 300 && status < 500 && status != http.StatusTooManyRequests { + return retry.NonRetryable(httpErr) + } + return httpErr } pageList, err = models.NewProjectListV1AlphaFromJson(bodyBytes) if err != nil {