Skip to content

Conversation

carlydf
Copy link
Contributor

@carlydf carlydf commented Dec 12, 2024

What changed?

Previously, request.PageSize was ignored and visibility max allowed page size was always used. Now, we use request.PageSize appropriately and also return an updated NextPageToken.

Why?

So that the list can be paginated.

How did you test it?

Added a unit test for this. Confirmed the test fails with the buggy code (static NextPageToken)

Potential risks

Documentation

Is hotfix candidate?

@carlydf carlydf requested a review from a team as a code owner December 12, 2024 01:25
@@ -367,8 +373,7 @@ func (d *DeploymentClientImpl) ListDeployments(
deployments = append(deployments, deploymentListInfo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: while we're here, let's change this loop to make(..., len(persistenceResp.Executions) and assign by index?

@@ -309,6 +309,24 @@ func (s *DeploymentSuite) verifyDeploymentListInfo(expectedDeploymentListInfo *d
return true
}

func (s *DeploymentSuite) listDeploymentsAllPages(ctx context.Context, request *workflowservice.ListDeploymentsRequest) ([]*deploymentpb.DeploymentListInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *DeploymentSuite) listDeploymentsAllPages(ctx context.Context, request *workflowservice.ListDeploymentsRequest) ([]*deploymentpb.DeploymentListInfo, error) {
func (s *DeploymentSuite) listDeploymentsAll(ctx context.Context, request *workflowservice.ListDeploymentsRequest) ([]*deploymentpb.DeploymentListInfo, error) {

akin to io.ReadAll?

Comment on lines 316 to 319
for {
if !(resp == nil || len(resp.NextPageToken) > 0) {
break
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for {
if !(resp == nil || len(resp.NextPageToken) > 0) {
break
}
for resp == nil || len(resp.NextPageToken) > 0 {

@carlydf carlydf merged commit 98ba15a into main Dec 12, 2024
49 checks passed
@carlydf carlydf deleted the cdf/fix-deployment-pagetoken branch December 12, 2024 18:37
bergundy pushed a commit that referenced this pull request Dec 17, 2024
…ments (#6972)

## What changed?
Previously, `request.PageSize` was ignored and visibility max allowed
page size was always used. Now, we use `request.PageSize` appropriately
and also return an updated NextPageToken.

## Why?
So that the list can be paginated.

## How did you test it?
Added a unit test for this. Confirmed the test fails with the buggy code
(static NextPageToken)

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants