Пример #1
0
        private async Task <BulkInsertAbortedException> GetExceptionFromOperation()
        {
            var stateRequest = new GetOperationStateCommand(_requestExecutor.Conventions, _operationId);
            await _requestExecutor.ExecuteAsync(stateRequest, _context, _token).ConfigureAwait(false);

            if (!(stateRequest.Result.Result is OperationExceptionResult error))
            {
                return(null);
            }
            return(new BulkInsertAbortedException(error.Error));
        }
Пример #2
0
        /// <summary>
        /// Since operation might complete before we subscribe to it,
        /// fetch operation status but only once  to avoid race condition
        /// If we receive notification using changes API meanwhile, ignore fetched status
        /// to avoid issues with non monotonic increasing progress
        /// </summary>
        private async Task FetchOperationStatus()
        {
            var command = new GetOperationStateCommand(_conventions, _id, _isServerStoreOperation);

            await _requestExecutor.ExecuteAsync(command, _context).ConfigureAwait(false);

            OnNext(new OperationStatusChange
            {
                OperationId = _id,
                State       = command.Result
            });
        }