Skip to content

Commit

Permalink
fix Azure#149 add mutex lock/unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
johejo committed Feb 26, 2020
1 parent 1839bfc commit e49376d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ package servicebus

import (
"context"
common "github.com/Azure/azure-amqp-common-go/v3"
"sync"
"time"

common "github.com/Azure/azure-amqp-common-go/v3"

"github.com/Azure/azure-amqp-common-go/v3/uuid"
"github.com/devigned/tab"
"github.com/Azure/go-amqp"
"github.com/devigned/tab"
)

type (
Expand Down Expand Up @@ -147,6 +148,9 @@ func (s *Sender) Send(ctx context.Context, msg *Message, opts ...SendOption) err
ctx, span := s.startProducerSpanFromContext(ctx, "sb.Sender.Send")
defer span.End()

s.clientMu.Lock()
defer s.clientMu.Unlock()

if msg.SessionID == nil {
msg.SessionID = &s.session.SessionID
next := s.session.getNext()
Expand Down

0 comments on commit e49376d

Please sign in to comment.