-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use requested PageSize and return correct NextPageToken in ListDeployments #6972
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
Conversation
@@ -367,8 +373,7 @@ func (d *DeploymentClientImpl) ListDeployments( | |||
deployments = append(deployments, deploymentListInfo) |
There was a problem hiding this comment.
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?
tests/deployment_test.go
Outdated
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
?
tests/deployment_test.go
Outdated
for { | ||
if !(resp == nil || len(resp.NextPageToken) > 0) { | ||
break | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for { | |
if !(resp == nil || len(resp.NextPageToken) > 0) { | |
break | |
} | |
for resp == nil || len(resp.NextPageToken) > 0 { |
…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) -->
What changed?
Previously,
request.PageSize
was ignored and visibility max allowed page size was always used. Now, we userequest.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?