-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Description
Right now, we use a recursive solution to support pagination, which will lead to a stackoverflow issue when there are too many pages. So we need to replace it with a loop solution. And following is a sample of current generated code for pagination. The recursive path is onOk -> WorkspacesListByResourceGroup_Call -> onOk
private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceListResult> response)
{
using( NoSynchronizationContext )
{
var _returnNow = global::System.Threading.Tasks.Task<bool>.FromResult(false);
overrideOnOk(responseMessage, response, ref _returnNow);
// if overrideOnOk has returned true, then return right away.
if ((null != _returnNow && await _returnNow))
{
return ;
}
// onOk - response for 200 / application/json
// response should be returning an array of some kind. +Pageable
// pageable / value / nextLink
var result = await response;
WriteObject(result.Value,true);
if (result.NextLink != null)
{
if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage )
{
requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.Method.Get );
await ((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; }
await this.Client.WorkspacesListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline);
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels