(producer sarama.AsyncProducer)
| 210 | } |
| 211 | |
| 212 | func (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 | |
| 225 | func (p *producerProvider) clear() { |
| 226 | p.producersLock.Lock() |
no test coverage detected