Skip to content

Commit

Permalink
remove deprecated LockRenewalHandler (#218)
Browse files Browse the repository at this point in the history
Co-authored-by: Stéphane Erbrech <[email protected]>
  • Loading branch information
karenychen and serbrech authored Apr 22, 2024
1 parent 1fd7ed8 commit c6b68a0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
12 changes: 0 additions & 12 deletions v2/lockrenewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"sync/atomic"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
Expand Down Expand Up @@ -65,17 +64,6 @@ func NewLockRenewalHandler(lockRenewer LockRenewer, options *LockRenewalOptions,
}
}

// Deprecated: use NewLockRenewalHandler
// NewRenewLockHandler starts a renewlock goroutine for each message received.
func NewRenewLockHandler(lockRenewer LockRenewer, interval *time.Duration, handler Handler) HandlerFunc {
return NewLockRenewalHandler(lockRenewer,
&LockRenewalOptions{
Interval: interval,
// default to false on the old handler signature to keep the same behavior
CancelMessageContextOnStop: to.Ptr(false)},
handler)
}

// peekLockRenewer starts a background goroutine that renews the message lock at the given interval until Stop() is called
// or until the passed in context is canceled.
// it is a pass through handler if the renewalInterval is nil
Expand Down
17 changes: 0 additions & 17 deletions v2/lockrenewer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,6 @@ func Test_RenewPeriodically(t *testing.T) {
20*time.Millisecond).Should(Succeed())
}

//nolint:staticcheck // still need to cover the deprecated func
func Test_NewLockRenewerHandler_defaultToNotCancelMessageContext(t *testing.T) {
g := NewWithT(t)
interval := 20 * time.Millisecond
sbRenewer := &fakeSBLockRenewer{
Err: &azservicebus.Error{Code: azservicebus.CodeLockLost},
}

handler := shuttle.NewRenewLockHandler(sbRenewer, &interval,
shuttle.HandlerFunc(func(ctx context.Context, settler shuttle.MessageSettler, message *azservicebus.ReceivedMessage) {
g.Consistently(func(g Gomega) {
g.Expect(ctx.Err()).To(BeNil())
}, "120ms", "10ms").Should(Succeed())
}))
handler.Handle(context.Background(), &fakeSettler{}, &azservicebus.ReceivedMessage{})
}

func Test_RenewPeriodically_Error(t *testing.T) {
type testCase struct {
name string
Expand Down

0 comments on commit c6b68a0

Please sign in to comment.