Gilthoniel commented on issue #1258:
URL:
https://github.com/apache/pulsar-client-go/issues/1258#issuecomment-2252142615
A different approach would be something like that:
```Go
// flushDataChan first empties the data channel as much as possible, then
send
// the different pending requests.
func (p *partitionProducer) flushDataChan() {
var reqs []*sendRequest
for {
select {
case pendingData := <-p.dataChan:
reqs = append(reqs, pendingData)
default:
for _, req := range reqs {
p.internalSend(req)
}
}
}
}
```
It would also avoid the channel allocation for every flush in high load
scenarios.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]