Skip to content

Commit

Permalink
Merge pull request #205 from princjef/receiver-block
Browse files Browse the repository at this point in the history
Unblock receiver goroutine on shutdown
  • Loading branch information
catalinaperalta authored Feb 11, 2021
2 parents f421926 + f043fdc commit 7b808b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## `v3.3.6`
- fix goroutine leak on listener close

## `v3.3.5`
- Remove the check for temporary network errors in sender.go [#80](https://github.com/Azure/azure-event-hubs-go/issues/80)

Expand Down
11 changes: 9 additions & 2 deletions receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,15 @@ func (r *receiver) listenForMessages(ctx context.Context, msgChan chan *amqp.Mes
for {
msg, err := r.listenForMessage(ctx)
if err == nil {
msgChan <- msg
continue
select {
case msgChan <- msg:
// Sent
continue
case <-ctx.Done():
// Context canceled before send, ignore and shut down
tab.For(ctx).Debug("context done")
return
}
}

select {
Expand Down

0 comments on commit 7b808b3

Please sign in to comment.