Skip to content

Commit 617504a

Browse files
committed
refactor: remove retrying from config download
1 parent be63e9d commit 617504a

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

pkg/cmd/init.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -392,30 +392,13 @@ func downloadStainlessConfig(ctx context.Context, client stainless.Client, slug
392392
}
393393

394394
group := Info("Downloading Stainless config...")
395-
396395
params := stainless.ProjectConfigGetParams{
397396
Project: stainless.String(slug),
398397
}
399398

400-
var configRes *stainless.ProjectConfigGetResponse
401-
var err error
402-
maxRetries := 3
403-
404-
// I'm not sure why, but our endpoint here doesn't work immediately after the project is created, but
405-
// retrying it reliably fixes it.
406-
for attempt := 1; attempt <= maxRetries; attempt++ {
407-
configRes, err = client.Projects.Configs.Get(ctx, params)
408-
if err == nil {
409-
break
410-
}
411-
412-
if attempt < maxRetries {
413-
time.Sleep(time.Duration(attempt) * time.Second)
414-
}
415-
}
416-
399+
configRes, err := client.Projects.Configs.Get(ctx, params)
417400
if err != nil {
418-
return fmt.Errorf("config download failed after %d attempts: %v", maxRetries, err)
401+
return fmt.Errorf("config download failed: %v", err)
419402
}
420403

421404
content := ""

0 commit comments

Comments
 (0)