Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
karenychen committed Aug 19, 2024
1 parent 21a1879 commit b73d27d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 1 addition & 3 deletions v2/managedsettling.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ func (m *ManagedSettler) Handle(ctx context.Context, settler MessageSettler, mes
m.options.OnError(ctx, m.options, settler, message, err)
return
}
settleCtx, cancel := context.WithTimeout(ctx, settlementTimeout)
defer cancel()
if err := settler.CompleteMessage(settleCtx, message, nil); err != nil {
if err := settler.CompleteMessage(ctx, message, nil); err != nil {
logger.Error(fmt.Sprintf("error completing message: %s", err))
m.options.OnAbandoned(ctx, message, err)
return
Expand Down
8 changes: 1 addition & 7 deletions v2/settlehandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ package shuttle
import (
"context"
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus"
"github.com/devigned/tab"
)

const settlementTimeout = 30 * time.Second

// Settlement represents an action to take on a message. Abandon, Complete, DeadLetter, Defer, NoOp
type Settlement interface {
Settle(context.Context, MessageSettler, *azservicebus.ReceivedMessage)
Expand Down Expand Up @@ -110,10 +107,7 @@ type settlement[T any] struct {
func (s settlement[T]) settle(ctx context.Context, settler MessageSettler, message *azservicebus.ReceivedMessage, options T) {
span := tab.FromContext(ctx)
span.Logger().Info(fmt.Sprintf("%s message", s.name))
settleCtx, cancel := context.WithTimeout(ctx, settlementTimeout)
defer cancel()
getLogger(ctx).Info(fmt.Sprintf("%s message with ID: %s", s.name, message.MessageID))
if err := s.settleFunc(settleCtx, settler, message, options); err != nil {
if err := s.settleFunc(ctx, settler, message, options); err != nil {
wrapped := fmt.Errorf("%s settlement failed: %w", s.name, err)
getLogger(ctx).Error(wrapped.Error())
span.Logger().Error(wrapped)
Expand Down

0 comments on commit b73d27d

Please sign in to comment.