Skip to content

Commit

Permalink
Ignore the send on closed channel error
Browse files Browse the repository at this point in the history
  • Loading branch information
BewareMyPower committed Nov 21, 2024
1 parent 1c39b66 commit 0dce2a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pulsar/consumer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,15 @@ func (pc *partitionConsumer) internalAckList(request *ackListRequest) {
}

func (pc *partitionConsumer) MessageReceived(response *pb.CommandMessage, headersAndPayload internal.Buffer) error {
defer func() {
if r := recover(); r != nil {
if err, ok := r.(error); ok && err.Error() == "send on closed channel" {
pc.log.WithField("panic", r).Debug("panic recovered in MessageReceived")
return
}
panic(r)
}
}()
pbMsgID := response.GetMessageId()

reader := internal.NewMessageReader(headersAndPayload)
Expand Down

0 comments on commit 0dce2a5

Please sign in to comment.