Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct the error handling in client.InitProducerID() #1718

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,12 @@ func (client *client) Broker(brokerID int32) (*Broker, error) {
}

func (client *client) InitProducerID() (*InitProducerIDResponse, error) {
var err error
err := ErrOutOfBrokers
for broker := client.any(); broker != nil; broker = client.any() {
var response *InitProducerIDResponse
req := &InitProducerIDRequest{}

response, err := broker.InitProducerID(req)
response, err = broker.InitProducerID(req)
switch err.(type) {
case nil:
return response, nil
Expand All @@ -228,6 +229,7 @@ func (client *client) InitProducerID() (*InitProducerIDResponse, error) {
client.deregisterBroker(broker)
}
}

return nil, err
}

Expand Down