watermill
watermill copied to clipboard
Update watermill to github.com/cenkalti/backoff/v4
This is an incremental update to use cenkalti/backoff/v4 rather than cenkalti/backoff/v3 and a notice that backoff/v5 requires some discussion from watermill maintainers.
https://github.com/cenkalti/backoff/releases/tag/v3.2.2 was released in 2020 https://github.com/cenkalti/backoff/releases/tag/v4.3.0 and 4.3.0 was released in 2024
I would have updated all the way to the latest (v5) but there are incompatible changes that require some bigger watermill changes https://github.com/cenkalti/backoff/compare/v4...v5
Most people are encouraged to move the backoff.v3 MaxElapsedTime functionality to the backoff.v5 Retry but watermill does not use backoff Retry
It looks like code that was previously using backoff v4:
operation := func() error {
// do stuff here
}
bo := backoff.NewExponentialBackOff()
bo.MaxElapsedTime = maxElapsedTime
err = backoff.Retry(ctx, operation, bo)
return err
Would need to be instead written in backoff v5 using backoff.Retry:
operation := func() error {
// do stuff here
}
bo := backoff.NewExponentialBackOff()
_, err = backoff.Retry(ctx,operation, bo, backoff.WithMaxElapsedTime(maxElapsedTime))
Backoff v5 Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[5.0.0] - 2024-12-19
Added
- RetryAfterError can be returned from an operation to indicate how long to wait before the next retry.
Changed
- Retry function now accepts additional options for specifying max number of tries and max elapsed time.
- Retry function now accepts a context.Context.
- Operation function signature changed to return result (any type) and error.
Removed
- RetryNotify* and RetryWithData functions. Only single Retry function remains.
- Optional arguments from ExponentialBackoff constructor.
- Clock and Timer interfaces.
Fixed
- The original error is returned from Retry if there's a PermanentError. (#144)
- The Retry function respects the wrapped PermanentError. (#140)