backoff icon indicating copy to clipboard operation
backoff copied to clipboard

Provide proper CHANGELOG for breaking changes

Open Airblader opened this issue 8 months ago • 4 comments

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.

Airblader avatar May 09 '25 07:05 Airblader

Thanks for the feedback! If you have specific suggestions or upgrade notes, feel free to send a PR—any help is appreciated!

cenkalti avatar May 10 '25 15:05 cenkalti

@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

StevenACoffman avatar May 11 '25 16:05 StevenACoffman

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.

jachym-tousek-keboola avatar May 19 '25 10:05 jachym-tousek-keboola

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.

cenkalti avatar May 19 '25 16:05 cenkalti

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 19 '25 02:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 03 '25 02:07 github-actions[bot]