apache / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
652 stars 335 forks source link

[Issue 1259][producer] Prevent panic when calling Flush on closed producer #1260

Closed Gilthoniel closed 2 months ago

Gilthoniel commented 2 months ago

Fixes #1259

Motivation

When calling Flush or FlushWithCtx after closing the producer, it will panic.

Modifications

Check the state of the producer before proceeding with a flush and return an error if it is closed already.

Verifying this change

This change added tests and can be verified as follows:

Does this pull request potentially affect one of the following parts:

None

Documentation