Provide proper CHANGELOG for breaking changes
Currently upgrading from v4 to v5, which has lots of breaking changes. Unfortunately the new CHANGELOG is less than helpful, and I find myself having to wade through PRs and even poorly written commits. This makes for a pretty bad developer experience, so would appreciate if breaking changes came with some useful instructions of what changes and how to migrate.
Thanks for the feedback! If you have specific suggestions or upgrade notes, feel free to send a PR—any help is appreciated!
@Airblader Please see https://github.com/cenkalti/backoff/blob/v5/CHANGELOG.md
However, I also would have liked tips on how to rewrite code to deal with MaxElapsedTime being removed from ExponentialBackOff between v4 and v5. Here is what I figured out for others.
It looks like code that was previously:
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 as:
operation := func() error {
// do stuff here
}
bo := backoff.NewExponentialBackOff()
_, err = backoff.Retry(ctx,operation, bo, backoff.WithMaxElapsedTime(maxElapsedTime))
I looked at: https://github.com/cenkalti/backoff/compare/v4...v5
I'm also running into issues while trying to update. If the old code is using backoff.Retry(), it's manageable using steven's comment above. But what about cases like this?
https://github.com/keboola/keboola-as-code/blob/93bc713497cb74be4fbe0bed8fdf5acf2e78f4e3/internal/pkg/service/common/etcdop/op/atomic_do.go#L14-L50 https://github.com/keboola/keboola-as-code/blob/93bc713497cb74be4fbe0bed8fdf5acf2e78f4e3/internal/pkg/service/common/etcdop/op/retry.go#L83
It's very unclear what to do here now that MaxElapsedTime and GetElapsedTime and related methods gone from the backoff instance - both of which we were using.
It's fine to stay on v4 if that works for you. You don't need to upgrade. There is no behavioral change. It's just a different API that uses the new generics feature of the language.
MaxElapsedTime is still here:
https://pkg.go.dev/github.com/cenkalti/backoff/v5#WithMaxElapsedTime
However, if you need to measure the elapsed time, you will need to do your own time tracking.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.