Skip to content

Commit

Permalink
Update module github.com/cenkalti/backoff/v4 to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrannajaryan committed Dec 19, 2024
1 parent b7beae5 commit 6ff007f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
6 changes: 2 additions & 4 deletions client/internal/httpsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"sync/atomic"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/open-telemetry/opamp-go/internal"
"github.com/cenkalti/backoff/v5"
"google.golang.org/protobuf/proto"

"github.com/open-telemetry/opamp-go/client/types"
"github.com/open-telemetry/opamp-go/internal"
"github.com/open-telemetry/opamp-go/protobufs"
)

Expand Down Expand Up @@ -176,8 +176,6 @@ func (h *HTTPSender) sendRequestWithRetries(ctx context.Context) (*http.Response

// Repeatedly try requests with a backoff strategy.
infiniteBackoff := backoff.NewExponentialBackOff()
// Make backoff run forever.
infiniteBackoff.MaxElapsedTime = 0

interval := time.Duration(0)

Expand Down
5 changes: 1 addition & 4 deletions client/wsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"sync/atomic"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/cenkalti/backoff/v5"
"github.com/gorilla/websocket"

"github.com/open-telemetry/opamp-go/client/internal"
Expand Down Expand Up @@ -202,9 +202,6 @@ func (c *wsClient) tryConnectOnce(ctx context.Context) (retryAfter sharedinterna
func (c *wsClient) ensureConnected(ctx context.Context) error {
infiniteBackoff := backoff.NewExponentialBackOff()

// Make ticker run forever.
infiniteBackoff.MaxElapsedTime = 0

interval := time.Duration(0)

for {
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/open-telemetry/opamp-go

go 1.22
go 1.23

toolchain go1.23.2

require (
github.com/cenkalti/backoff/v4 v4.3.0
github.com/cenkalti/backoff/v5 v5.0.0
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
github.com/stretchr/testify v1.10.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cenkalti/backoff/v5 v5.0.0 h1:4ziwFuaVJicDO1ah1Nz1aXXV1caM28PFgf1V5TTFXew=
github.com/cenkalti/backoff/v5 v5.0.0/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
Expand Down
7 changes: 5 additions & 2 deletions internal/examples/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/open-telemetry/opamp-go/internal/examples

go 1.22
go 1.23

toolchain go1.23.2

require (
github.com/cenkalti/backoff/v4 v4.3.0
github.com/cenkalti/backoff/v5 v5.0.0
github.com/google/uuid v1.6.0
github.com/knadh/koanf v1.3.3
github.com/oklog/ulid/v2 v2.1.0
Expand All @@ -20,6 +22,7 @@ require (
)

require (
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
Expand Down
2 changes: 2 additions & 0 deletions internal/examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAm
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/cenkalti/backoff/v5 v5.0.0 h1:4ziwFuaVJicDO1ah1Nz1aXXV1caM28PFgf1V5TTFXew=
github.com/cenkalti/backoff/v5 v5.0.0/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
3 changes: 1 addition & 2 deletions internal/examples/supervisor/supervisor/supervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sync/atomic"
"time"

"github.com/cenkalti/backoff/v4"
"github.com/cenkalti/backoff/v5"
"github.com/google/uuid"
"github.com/knadh/koanf"
"github.com/knadh/koanf/parsers/yaml"
Expand Down Expand Up @@ -424,7 +424,6 @@ func (s *Supervisor) startAgent() {
// Prepare health checker
healthCheckBackoff := backoff.NewExponentialBackOff()
healthCheckBackoff.MaxInterval = 60 * time.Second
healthCheckBackoff.MaxElapsedTime = 0 // Never stop
if s.healthCheckTicker != nil {
s.healthCheckTicker.Stop()
}
Expand Down

0 comments on commit 6ff007f

Please sign in to comment.