// TODO: Find all using of WaitNext and replace by Do to avoid panic.
Find all using of WaitNext and replace by Do to avoid panic.
// TODO : Find all using of WaitNext and replace by Do to avoid panic .
func (r *retry) WaitNext(ctx context.Context) bool {
	defer func() {
		r.calls++
	}()
	if r.calls >= r.max {
		return false
	}
	d := r.backoff.Next()
	if d == 0 {
		select {
		case <-ctx.Done():
			return false
		default:
			return true
		}
	}
	t := time.NewTimer(d)
	select {
	case <-ctx.Done():
		return false
	case <-t.C:
		return true
	}
}
func ( r * retry ) WaitNext ( ctx context . Context ) bool { defer func ( ) { r . calls ++ } ( ) if r . calls >= r . max { return false } d := r . backoff . Next ( ) if d == 0 { select { case <- ctx . Done ( ) : return false default : return true } } t := time . NewTimer ( d ) select { case <- ctx . Done ( ) : return false case <- t . C : return true } }
Find all using of WaitNext and replace by Do to avoid panic.
Find all using of WaitNext and replace by Do to avoid panic .