MCPcopy Index your code
hub / github.com/cloudflare/cloudflared / Backoff

Method Backoff

retry/backoffhandler.go:89–100  ·  view source on GitHub ↗

Backoff is used to wait according to exponential backoff. Returns false if the maximum number of retries have been used or if the underlying context has been cancelled.

(ctx context.Context)

Source from the content-addressed store, hash-verified

87// Backoff is used to wait according to exponential backoff. Returns false if the
88// maximum number of retries have been used or if the underlying context has been cancelled.
89func (b *BackoffHandler) Backoff(ctx context.Context) bool {
90 c := b.BackoffTimer()
91 if c == nil {
92 return false
93 }
94 select {
95 case <-c:
96 return true
97 case <-ctx.Done():
98 return false
99 }
100}
101
102// Sets a grace period within which the backoff timer is maintained. After the grace
103// period expires, the number of retries & backoff duration is reset.

Callers 6

TestBackoffRetriesFunction · 0.95
TestBackoffCancelFunction · 0.95
TestBackoffGracePeriodFunction · 0.95
TestBackoffRetryForeverFunction · 0.95

Calls 1

BackoffTimerMethod · 0.95

Tested by 6

TestBackoffRetriesFunction · 0.76
TestBackoffCancelFunction · 0.76
TestBackoffGracePeriodFunction · 0.76
TestBackoffRetryForeverFunction · 0.76