This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git
The following commit(s) were added to refs/heads/master by this push:
new 91906f5 [ISSUE #87] Ensure all producer partitions are closed. (#92)
91906f5 is described below
commit 91906f5661adc6744baa420143532cdddc4af39e
Author: cckellogg <[email protected]>
AuthorDate: Mon Nov 11 16:50:24 2019 -0800
[ISSUE #87] Ensure all producer partitions are closed. (#92)
---
pulsar/impl_producer.go | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/pulsar/impl_producer.go b/pulsar/impl_producer.go
index 5606f86..d806087 100644
--- a/pulsar/impl_producer.go
+++ b/pulsar/impl_producer.go
@@ -19,6 +19,8 @@ package pulsar
import (
"context"
+ "fmt"
+ "github.com/pkg/errors"
"github.com/apache/pulsar-client-go/pulsar/internal"
)
@@ -144,14 +146,21 @@ func (p *producer) LastSequenceID() int64 {
func (p *producer) Flush() error {
for _, pp := range p.producers {
- return pp.Flush()
+ if err := pp.Flush(); err != nil {
+ return err
+ }
+
}
return nil
}
func (p *producer) Close() error {
+ var errs error
for _, pp := range p.producers {
- return pp.Close()
+ if err := pp.Close(); err != nil {
+ errs = errors.Wrap(err, fmt.Sprintf("unable to close
producer %s", p.Name()))
+ }
+
}
- return nil
+ return errs
}