Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
  • Loading branch information
hindessm authored and dnwe committed Aug 30, 2023
1 parent 87229d9 commit f3c4194
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ func (ca *clusterAdmin) refreshController() (*Broker, error) {
return ca.client.RefreshController()
}

// isErrNoController returns `true` if the given error type unwraps to an
// isErrNotController returns `true` if the given error type unwraps to an
// `ErrNotController` response from Kafka
func isErrNoController(err error) bool {
func isErrNotController(err error) bool {
return errors.Is(err, ErrNotController)
}

Expand Down Expand Up @@ -249,7 +249,7 @@ func (ca *clusterAdmin) CreateTopic(topic string, detail *TopicDetail, validateO
request.Version = 1
}

return ca.retryOnError(isErrNoController, func() error {
return ca.retryOnError(isErrNotController, func() error {
b, err := ca.Controller()
if err != nil {
return err
Expand Down Expand Up @@ -278,14 +278,14 @@ func (ca *clusterAdmin) CreateTopic(topic string, detail *TopicDetail, validateO

func (ca *clusterAdmin) DescribeTopics(topics []string) (metadata []*TopicMetadata, err error) {
var response *MetadataResponse
err = ca.retryOnError(isErrNoController, func() error {
err = ca.retryOnError(isErrNotController, func() error {
controller, err := ca.Controller()
if err != nil {
return err
}
request := NewMetadataRequest(ca.conf.Version, topics)
response, err = controller.GetMetadata(request)
if isErrNoController(err) {
if isErrNotController(err) {
_, _ = ca.refreshController()
}
return err
Expand All @@ -298,15 +298,15 @@ func (ca *clusterAdmin) DescribeTopics(topics []string) (metadata []*TopicMetada

func (ca *clusterAdmin) DescribeCluster() (brokers []*Broker, controllerID int32, err error) {
var response *MetadataResponse
err = ca.retryOnError(isErrNoController, func() error {
err = ca.retryOnError(isErrNotController, func() error {
controller, err := ca.Controller()
if err != nil {
return err
}

request := NewMetadataRequest(ca.conf.Version, nil)
response, err = controller.GetMetadata(request)
if isErrNoController(err) {
if isErrNotController(err) {
_, _ = ca.refreshController()
}
return err
Expand Down Expand Up @@ -438,7 +438,7 @@ func (ca *clusterAdmin) DeleteTopic(topic string) error {
request.Version = 1
}

return ca.retryOnError(isErrNoController, func() error {
return ca.retryOnError(isErrNotController, func() error {
b, err := ca.Controller()
if err != nil {
return err
Expand Down Expand Up @@ -482,7 +482,7 @@ func (ca *clusterAdmin) CreatePartitions(topic string, count int32, assignment [
request.Version = 1
}

return ca.retryOnError(isErrNoController, func() error {
return ca.retryOnError(isErrNotController, func() error {
b, err := ca.Controller()
if err != nil {
return err
Expand Down Expand Up @@ -523,7 +523,7 @@ func (ca *clusterAdmin) AlterPartitionReassignments(topic string, assignment [][
request.AddBlock(topic, int32(i), assignment[i])
}

return ca.retryOnError(isErrNoController, func() error {
return ca.retryOnError(isErrNotController, func() error {
b, err := ca.Controller()
if err != nil {
return err
Expand Down Expand Up @@ -570,15 +570,15 @@ func (ca *clusterAdmin) ListPartitionReassignments(topic string, partitions []in
request.AddBlock(topic, partitions)

var rsp *ListPartitionReassignmentsResponse
err = ca.retryOnError(isErrNoController, func() error {
err = ca.retryOnError(isErrNotController, func() error {
b, err := ca.Controller()
if err != nil {
return err
}
_ = b.Open(ca.client.Config())

rsp, err = b.ListPartitionReassignments(request)
if isErrNoController(err) {
if isErrNotController(err) {
_, _ = ca.refreshController()
}
return err
Expand Down Expand Up @@ -1204,7 +1204,7 @@ func (ca *clusterAdmin) AlterUserScramCredentials(u []AlterUserScramCredentialsU
}

var rsp *AlterUserScramCredentialsResponse
err := ca.retryOnError(isErrNoController, func() error {
err := ca.retryOnError(isErrNotController, func() error {
b, err := ca.Controller()
if err != nil {
return err
Expand Down

0 comments on commit f3c4194

Please sign in to comment.