Skip to content

Commit

Permalink
fix Send callback stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
billowqiu committed Oct 17, 2022
1 parent 858b1e9 commit fc0a56d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,15 @@ func (p *partitionProducer) Send(ctx context.Context, msg *ProducerMessage) (Mes
}, true)

// wait for send request to finish
<-doneCh
return msgID, err
for {
select {
case <-ctx.Done():
isDone.Store(true)
return msgID, ctx.Err()
case <-doneCh:
return msgID, err
}
}
}

func (p *partitionProducer) SendAsync(ctx context.Context, msg *ProducerMessage,
Expand Down

0 comments on commit fc0a56d

Please sign in to comment.