MCPcopy
hub / github.com/IBM/sarama / release

Method release

examples/txn_producer/main.go:212–223  ·  view source on GitHub ↗
(producer sarama.AsyncProducer)

Source from the content-addressed store, hash-verified

210}
211
212func (p *producerProvider) release(producer sarama.AsyncProducer) {
213 p.producersLock.Lock()
214 defer p.producersLock.Unlock()
215
216 // If released producer is erroneous close it and don't return it to the producer pool.
217 if producer.TxnStatus()&sarama.ProducerTxnFlagInError != 0 {
218 // Try to close it
219 _ = producer.Close()
220 return
221 }
222 p.producers = append(p.producers, producer)
223}
224
225func (p *producerProvider) clear() {
226 p.producersLock.Lock()

Callers 1

produceTestRecordFunction · 0.45

Calls 2

TxnStatusMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected