Explorar o código

clean up on producer close

Burke Libbey %!s(int64=12) %!d(string=hai) anos
pai
achega
7b7dcc88ff
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      producer.go

+ 5 - 1
producer.go

@@ -111,7 +111,11 @@ func (p *Producer) Errors() chan error {
 // it may otherwise leak memory. You must call this before calling Close on the
 // underlying client.
 func (p *Producer) Close() error {
-	// TODO
+	p.m.Lock()
+	defer p.m.Unlock()
+	for _, bp := range p.brokerProducers {
+		bp.Close()
+	}
 	return nil
 }