public async Task WaitForCompletion() { var polling = pollingStrategy.Start(); while (true) { var status = await checkStatusAsync(TaskId).ConfigureAwait(false); if (status.EnsureSuccess().IsCompleted) { return; } await polling.WaitForNextAttempt().ConfigureAwait(false); } }
public override async Task <LongOperationResult <TResult, TFailure> > WaitForSuccessOrFailure() { var polling = pollingStrategy.Start(); while (true) { var taskResult = await checkStatusAsync(TaskId).ConfigureAwait(false); var longOperationResult = ToLongOperationResult(taskResult); if (longOperationResult.HasValue) { return(longOperationResult.Value); } await polling.WaitForNextAttempt().ConfigureAwait(false); } }
public async Task <T> WaitForCompletion() { var polling = pollingStrategy.Start(); while (true) { var taskResult = await checkStatusAsync(TaskId).ConfigureAwait(false); if (taskResult.TryGetSuccessResult(out var successResult)) { return(successResult); } if (taskResult.TryGetTaskError(out var apiError)) { throw Errors.LongOperationFailed(apiError); } await polling.WaitForNextAttempt().ConfigureAwait(false); } }