private async ValueTask <Response> WaitForCompletionAsync(bool async, OperationInternalBase operation, TimeSpan?suggestedInterval, CancellationToken cancellationToken) { while (true) { Response response = async ? await operation.UpdateStatusAsync(cancellationToken).ConfigureAwait(false) : operation.UpdateStatus(cancellationToken); if (operation.HasCompleted) { return(operation.RawResponse); } await Delay(async, _delayStrategy.GetNextDelay(response, suggestedInterval), cancellationToken).ConfigureAwait(false); } }
public Response WaitForCompletionResponse(OperationInternalBase operation, TimeSpan?suggestedInterval, CancellationToken cancellationToken) => WaitForCompletionAsync(false, operation, suggestedInterval, cancellationToken).EnsureCompleted();
public ValueTask <Response> WaitForCompletionResponseAsync(OperationInternalBase operation, TimeSpan?suggestedInterval, CancellationToken cancellationToken) => WaitForCompletionAsync(true, operation, suggestedInterval, cancellationToken);