INNER CODE UNIT · Go
probeGETWithRetry
platform-engineering-labs/formae · cmd/bundle-examples/main.go:306
func probeGETWithRetry(url string, attempts int, base time.Duration) error {
var last error
for i := 0; i < attempts; i++ {
if i > 0 {
delay := base * time.Duration(1<<uint(i-1))
fmt.Printf("bundle-examples: waiting %s before retrying %s (attempt %d/%d)\n", delay, url, i+1, attempts)
time.Sleep(delay)
}
last = probeGET(url)
if last == nil {
return nil
}
}
return last
}
// fetchExamples downloads <repo>@<tag> and extracts the examples/ subtree into
// dst. Returns (hasExamplesDir, filesWritten). Unsupported tar entry types fail.