()
| 554 | } |
| 555 | |
| 556 | func (p *asyncProducer) Close() error { |
| 557 | p.AsyncClose() |
| 558 | |
| 559 | if p.conf.Producer.Return.Successes { |
| 560 | go withRecover(func() { |
| 561 | for range p.successes { |
| 562 | } |
| 563 | }) |
| 564 | } |
| 565 | |
| 566 | var pErrs ProducerErrors |
| 567 | if p.conf.Producer.Return.Errors { |
| 568 | for event := range p.errors { |
| 569 | pErrs = append(pErrs, event) |
| 570 | } |
| 571 | } else { |
| 572 | <-p.errors |
| 573 | } |
| 574 | |
| 575 | if len(pErrs) > 0 { |
| 576 | return pErrs |
| 577 | } |
| 578 | return nil |
| 579 | } |
| 580 | |
| 581 | func (p *asyncProducer) AsyncClose() { |
| 582 | go withRecover(p.shutdown) |
nothing calls this directly
no test coverage detected