func()

in exponential/exponential.go [338:361]


func (b *Backoff) ctxOK(ctx context.Context, interval time.Duration) bool {
	if ctx.Err() != nil {
		return false
	}

	deadline, ok := ctx.Deadline()
	if !ok {
		return true
	}

	// We have a deadline, so let's see if we have time for another attempt.
	remaining := b.until(deadline)
	if remaining <= 0 {
		return false
	}

	// We have time for another attempt, but we need to see if we have time for the interval.
	if remaining < interval {
		return false
	}

	// We have time for the interval.
	return true
}