MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / runWithBackoffRetry

Function runWithBackoffRetry

app/cli/cmd/errors.go:78–96  ·  view source on GitHub ↗
(fn func() error)

Source from the content-addressed store, hash-verified

76}
77
78func runWithBackoffRetry(fn func() error) error {
79 return backoff.RetryNotify(
80 func() error {
81 err := fn()
82 if !isRetriableAPIError(err) {
83 return backoff.Permanent(err)
84 }
85 return err
86 },
87 backoff.NewExponentialBackOff(backoff.WithMaxElapsedTime(3*time.Minute)),
88 func(err error, delay time.Duration) {
89 l := logger.Debug().Err(err)
90 if v1.IsAttestationStateErrorConflict(err) {
91 l.Msgf("concurrent state update detected, retrying in %s", delay)
92 } else {
93 l.Msgf("retrying in %s", delay)
94 }
95 })
96}

Callers 3

newAttestationPushCmdFunction · 0.85
newAttestationInitCmdFunction · 0.85
newAttestationAddCmdFunction · 0.85

Calls 3

isRetriableAPIErrorFunction · 0.85
DebugMethod · 0.45

Tested by

no test coverage detected