Source File
context.go
Belonging Package
github.com/cenkalti/backoff/v4
package backoffimport ()// BackOffContext is a backoff policy that stops retrying after the context// is canceled.type BackOffContext interface { // nolint: golintBackOffContext() context.Context}type backOffContext struct {BackOffctx context.Context}// WithContext returns a BackOffContext with context ctx//// ctx must not be nilfunc ( BackOff, context.Context) BackOffContext { // nolint: golintif == nil {panic("nil context")}if , := .(*backOffContext); {return &backOffContext{BackOff: .BackOff,ctx: ,}}return &backOffContext{BackOff: ,ctx: ,}}func ( BackOff) context.Context {if , := .(BackOffContext); {return .Context()}if , := .(*backOffTries); {return (.delegate)}return context.Background()}func ( *backOffContext) () context.Context {return .ctx}func ( *backOffContext) () time.Duration {select {case <-.ctx.Done():return Stopdefault:return .BackOff.NextBackOff()}}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |