Skip to content

Commit 9593bbe

Browse files
authored
update to translation LRO to not prefecth first page (Azure#27365)
* update to translation LRO to not prefecth first page * revert record mode comment
1 parent 1538484 commit 9593bbe

13 files changed

+3959
-10681
lines changed

sdk/translation/Azure.AI.Translation.Document/src/DocumentTranslationOperation.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,6 @@ public class DocumentTranslationOperation : PageableOperation<DocumentStatusResu
122122
/// </summary>
123123
private int? _retryAfterHeaderValue;
124124

125-
/// <summary>
126-
/// Provides the results for the first page.
127-
/// </summary>
128-
private Page<DocumentStatusResult> _firstPage;
129-
130125
/// <summary>
131126
/// Returns true if the long-running operation completed successfully and has produced final result (accessible by Value property).
132127
/// </summary>
@@ -226,22 +221,7 @@ public async override ValueTask<Response<AsyncPageable<DocumentStatusResult>>> W
226221
TimeSpan pollingInterval,
227222
CancellationToken cancellationToken = default)
228223
{
229-
await this.DefaultWaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false);
230-
var response = await _serviceClient.GetDocumentsStatusAsync(new Guid(Id), cancellationToken: cancellationToken).ConfigureAwait(false);
231-
_firstPage = Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
232-
_hasValue = true;
233-
234-
async Task<Page<DocumentStatusResult>> NextPageFunc(string nextLink, int? pageSizeHint)
235-
{
236-
// TODO: diagnostics scope?
237-
var response = await _serviceClient.GetDocumentsStatusNextPageAsync(nextLink, new Guid(Id), cancellationToken: cancellationToken)
238-
.ConfigureAwait(false);
239-
240-
return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
241-
}
242-
243-
var result = PageableHelpers.CreateAsyncEnumerable(_ => Task.FromResult(_firstPage), NextPageFunc);
244-
return Response.FromValue(result, response);
224+
return await this.DefaultWaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false);
245225
}
246226

247227
/// <summary>

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByCreatedAfterTest.json

Lines changed: 147 additions & 237 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByCreatedAfterTestAsync.json

Lines changed: 147 additions & 237 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByCreatedBeforeTest.json

Lines changed: 236 additions & 1178 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByCreatedBeforeTestAsync.json

Lines changed: 307 additions & 1153 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByIdsTest.json

Lines changed: 162 additions & 1077 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByIdsTestAsync.json

Lines changed: 162 additions & 1173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByStatusTest.json

Lines changed: 459 additions & 986 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesFilterByStatusTestAsync.json

Lines changed: 462 additions & 898 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/translation/Azure.AI.Translation.Document/tests/SessionRecords/DocumentTranslationClientLiveTests/GetTranslationStatusesOrderByCreatedOnTest.json

Lines changed: 598 additions & 1522 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)