Skip to content
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

Support paginated response in GET-AzureRmMlWebService #2957

Merged
merged 1 commit into from
Sep 20, 2016

Conversation

NonStatic2014
Copy link
Contributor

Paginated response will happen when there are more than 1000 items returned back from the server. This is a corner case for current Azure Machine Learning users. So this change is for future-proof.

this.CancellationToken).Result;
// This is a call for resource retrieval within a resource group
getFirstServicesPageCall = () => this.WebServicesClient.GetAzureMlWebServicesBySubscriptionAndGroupAsync(this.ResourceGroupName, null, this.CancellationToken);
getNextPageCall = nextLink => this.WebServicesClient.GetAzureMlWebServicesBySubscriptionAndGroupAsync(this.ResourceGroupName, nextLink, this.CancellationToken);
Copy link
Member

Choose a reason for hiding this comment

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

@NonStatic2014 it looks like if this.ResourceGroupName isn't null, then these two methods will be called twice (once before the if-statement, and once inside. Is there a reason for doing this instead of doing the following:

if (this.ResourceGroupName != null)
{
     Func<Task<ResponseWithContinuation<WebService[]>>> getFirstServicesPageCall = () => this.WebServicesClient.GetAzureMlWebServicesBySubscriptionAsync(this.ResourceGroupName, null, this.CancellationToken);
     Func<string, Task<ResponseWithContinuation<WebService[]>>> getNextPageCall = nextLink => this.WebServicesClient.GetAzureMlWebServicesBySubscriptionAsync(this.ResourceGroupName, nextLink, this.CancellationToken);
}
else
{
     Func<Task<ResponseWithContinuation<WebService[]>>> getFirstServicesPageCall = () => this.WebServicesClient.GetAzureMlWebServicesBySubscriptionAsync(null, this.CancellationToken);
     Func<string, Task<ResponseWithContinuation<WebService[]>>> getNextPageCall = nextLink => this.WebServicesClient.GetAzureMlWebServicesBySubscriptionAsync(nextLink, this.CancellationToken);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is the same thing, just an overwrite if this.ResourceGroupName is not null.

@cormacpayne
Copy link
Member

LGTM

@cormacpayne cormacpayne merged commit 35d5b90 into Azure:dev Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants