Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(deps): update module github.com/cenkalti/backoff/v4 to v5 (#17630)

renovate[bot]251d67ab2eae
diff --git a/backend/common/retry.go b/backend/common/retry.go
index e474dccc5e..6c0c7ae0eb 100644
--- a/backend/common/retry.go
+++ b/backend/common/retry.go
@@ -5,7 +5,7 @@ import (
"context"
"time"
- "github.com/cenkalti/backoff/v4"
+ "github.com/cenkalti/backoff/v5"
)
const (
@@ -16,14 +16,11 @@ const (
// Retry uses exponential backoff with timeout.
func Retry(ctx context.Context, fn func() error) error {
- b := backoff.WithMaxRetries(
- backoff.NewExponentialBackOff(
- backoff.WithMaxElapsedTime(timeout),
- backoff.WithInitialInterval(initialInterval),
- ),
- 3,
- )
- b.Reset()
- bWithContext := backoff.WithContext(b, ctx)
- return backoff.Retry(fn, bWithContext)
+ b := backoff.NewExponentialBackOff()
+ b.InitialInterval = initialInterval
+
+ _, err := backoff.Retry(ctx, func() (struct{}, error) {
+ return struct{}{}, fn()
+ }, backoff.WithBackOff(b), backoff.WithMaxElapsedTime(timeout), backoff.WithMaxTries(3))
+ return err
}
diff --git a/backend/plugin/webhook/dingtalk/dingtalk.go b/backend/plugin/webhook/dingtalk/dingtalk.go
index cec321a8ba..937af2e8a3 100644
--- a/backend/plugin/webhook/dingtalk/dingtalk.go
+++ b/backend/plugin/webhook/dingtalk/dingtalk.go
@@ -10,7 +10,7 @@ import (
"net/http"
"strings"
- "github.com/cenkalti/backoff/v4"
+ "github.com/cenkalti/backoff/v5"
"github.com/pkg/errors"
"go.uber.org/multierr"
diff --git a/backend/plugin/webhook/wecom/wecom.go b/backend/plugin/webhook/wecom/wecom.go
index 63aff3b92d..586e4baf85 100644
--- a/backend/plugin/webhook/wecom/wecom.go
+++ b/backend/plugin/webhook/wecom/wecom.go
@@ -10,7 +10,7 @@ import (
"net/http"
"strings"
- "github.com/cenkalti/backoff/v4"
+ "github.com/cenkalti/backoff/v5"
"github.com/pkg/errors"
"go.uber.org/multierr"
diff --git a/go.mod b/go.mod
index e0960f29d0..60135aa5a3 100644
--- a/go.mod
+++ b/go.mod
@@ -38,7 +38,7 @@ require (
github.com/bytebase/tidb-parser v0.0.0-20240821091609-162fffe2a839
github.com/bytebase/trino-parser v0.0.0-20250502000119-9977709a63e8
github.com/caarlos0/env/v11 v11.3.1
- github.com/cenkalti/backoff/v4 v4.3.0
+ github.com/cenkalti/backoff/v5 v5.0.3
github.com/cockroachdb/cockroachdb-parser v0.25.2
github.com/coreos/go-oidc v2.4.0+incompatible
github.com/databricks/databricks-sdk-go v0.85.0
@@ -143,7 +143,7 @@ require (
github.com/biogo/store v0.0.0-20201120204734-aad293a2328f // indirect
github.com/blevesearch/snowballstem v0.9.0 // indirect
github.com/boombuler/barcode v1.0.2 // indirect
- github.com/cenkalti/backoff/v5 v5.0.3 // indirect
+ github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cloudfoundry/gosigar v1.3.6 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect