Skip to content

Performance improvements

Latest
Compare
Choose a tag to compare
@kamilsk kamilsk released this 10 Jun 09:10

Incompatible changes

  • Action: changed from func(attempt uint) error to func(context.Context) error
  • How: changed from []func(attempt uint, err error) bool to []func(strategy.Breaker, uint, error) bool
  • Retry: removed
  • Try: removed
  • TryContext: removed
  • IsInterrupted: removed
  • IsRecovered: removed
  • BreakCloser: not supported anymore
  • Breaker: extended by Err() error

strategy

  • Strategy: changed from func(attempt uint, err error) bool to func(breaker Breaker, attempt uint, err error) bool

Compatible changes

strategy

  • ErrorHandler: added
  • CheckError: added
  • NetworkError: added

Improvements

backoff

  • Do: no run goroutine
  • Fibonacci: performance

How to switch

  • Provide a valid generator for jitters if you used nil before.
  • Use Do or Go instead of Retry, Try, or TryContext.
    • Do, if action is interruptible by context.
    • Go, if not and you need latency guarantees.
  • Close resources of BreakCloser manually.

v4.8.0...v5.0.0