Skip to content

Commit 9e8c21a

Browse files
authored
Merge pull request #160 from replicatedhq/divolgin/ls
Show correct channels for customers
2 parents 9eafafb + b736250 commit 9e8c21a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/kotsclient/customer_list.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,22 @@ type CustomerListResponse struct {
2525

2626
func (c *VendorV3Client) ListCustomers(appID string) ([]types.Customer, error) {
2727
allCustomers := []types.Customer{}
28-
resp := CustomerListResponse{}
2928
page := 0
30-
for len(allCustomers) < resp.TotalCustomers || page == 0 {
29+
for {
30+
resp := CustomerListResponse{}
3131
path := fmt.Sprintf("/v3/app/%s/customers?currentPage=%d", appID, page)
3232
err := c.DoJSON("GET", path, http.StatusOK, nil, &resp)
3333
if err != nil {
3434
return nil, errors.Wrapf(err, "list customers page %d", page)
3535
}
36+
3637
allCustomers = append(allCustomers, resp.Customers...)
37-
page = page + 1
38-
if len(resp.Customers) == 0 {
38+
39+
if len(allCustomers) == resp.TotalCustomers || len(resp.Customers) == 0 {
3940
break
4041
}
42+
43+
page = page + 1
4144
}
4245

4346
return allCustomers, nil

pkg/kotsclient/release.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ func (c *GraphQLClient) UpdateRelease(appID string, sequence int64, multiyaml st
121121

122122
func (c *VendorV3Client) ListReleases(appID string) ([]types.ReleaseInfo, error) {
123123
allReleases := []types.ReleaseInfo{}
124-
resp := types.ListReleasesResponse{}
125124
done := false
126125
page := 0
127126
for !done {
127+
resp := types.ListReleasesResponse{}
128128
path := fmt.Sprintf("/v3/app/%s/releases?currentPage=%d&pageSize=20", appID, page)
129129
err := c.DoJSON("GET", path, http.StatusOK, nil, &resp)
130130
if err != nil {
@@ -146,7 +146,6 @@ func (c *VendorV3Client) ListReleases(appID string) ([]types.ReleaseInfo, error)
146146
activeChannels = append(activeChannels, activeChannel)
147147
}
148148

149-
150149
newReleaseInfo := types.ReleaseInfo{
151150
ActiveChannels: activeChannels,
152151
AppID: release.AppID,

0 commit comments

Comments
 (0)