MCPcopy
hub / github.com/grafana/dskit / Wait

Method Wait

backoff/backoff.go:84–97  ·  view source on GitHub ↗

Wait sleeps for the backoff time then increases the retry count and backoff time Returns immediately if Context is terminated

()

Source from the content-addressed store, hash-verified

82// Wait sleeps for the backoff time then increases the retry count and backoff time
83// Returns immediately if Context is terminated
84func (b *Backoff) Wait() {
85 // Increase the number of retries and get the next delay
86 sleepTime := b.NextDelay()
87
88 if b.Ongoing() {
89 timer := time.NewTimer(sleepTime)
90 defer timer.Stop()
91
92 select {
93 case <-b.ctx.Done():
94 case <-timer.C:
95 }
96 }
97}
98
99func (b *Backoff) NextDelay() time.Duration {
100 b.numRetries++

Calls 4

NextDelayMethod · 0.95
OngoingMethod · 0.95
StopMethod · 0.65
DoneMethod · 0.65