Skip to content

Commit

Permalink
fix: add retry logic to ListPartitionReassignments
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hindess <[email protected]>
  • Loading branch information
hindessm authored and dnwe committed Jul 25, 2023
1 parent 66ef5a9 commit aad8cf3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,20 @@ func (ca *clusterAdmin) ListPartitionReassignments(topic string, partitions []in

request.AddBlock(topic, partitions)

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

rsp, err := b.ListPartitionReassignments(request)
rsp, err = b.ListPartitionReassignments(request)
if isErrNoController(err) {
_, _ = ca.refreshController()
}
return err
})

if err == nil && rsp != nil {
return rsp.TopicStatus, nil
Expand Down

0 comments on commit aad8cf3

Please sign in to comment.