src/server/pkg/backoff/retry.go
func RetryNotify(operation Operation, b BackOff, notify Notify) error {
	var err error
	var next time.Duration

	b.Reset()
	for {
		if err = operation(); err == nil {
			return nil
		}

		if next = b.NextBackOff(); next == Stop {
			return err
		}

		if notify != nil {
			if err := notify(err, next); err != nil {
				return err
			}
		}

		time.Sleep(next)
	}
}
func RetryNotify(operation Operation, b BackOff, notify Notify) error {
	var err error
	var next time.Duration

	b.Reset()
	for {
		if err = operation(); err == nil {
			return nil
		}

		if next = b.NextBackOff(); next == Stop {
			return err
		}

		if notify != nil {
			if err := notify(err, next); err != nil {
				return err
			}
		}

		time.Sleep(next)
	}
}
func RetryNotify ( operation Operation , b BackOff , notify Notify ) error { var err error var next time . Duration b . Reset ( ) for { if err = operation ( ) ; err == nil { return nil } if next = b . NextBackOff ( ) ; next == Stop { return err } if notify != nil { if err := notify ( err , next ) ; err != nil { return err } } time . Sleep ( next ) } }
// RetryNotify calls notify function with the error and wait duration
// for each failed attempt before sleep.
RetryNotify calls notify function with the error and wait duration for each failed attempt before sleep .