private static IDocumentClientRetryPolicy GetRetryPolicy(
     ContainerInternal containerInternal,
     OperationType operationType,
     RetryOptions retryOptions)
 {
     return(new BulkExecutionRetryPolicy(
                containerInternal,
                operationType,
                new ResourceThrottleRetryPolicy(
                    retryOptions.MaxRetryAttemptsOnThrottledRequests,
                    retryOptions.MaxRetryWaitTimeInSeconds)));
 }
        public ClientRetryPolicy(
            GlobalEndpointManager globalEndpointManager,
            bool enableEndpointDiscovery,
            RetryOptions retryOptions)
        {
            this.throttlingRetry = new ResourceThrottleRetryPolicy(
                retryOptions.MaxRetryAttemptsOnThrottledRequests,
                retryOptions.MaxRetryWaitTimeInSeconds);

            this.globalEndpointManager        = globalEndpointManager;
            this.failoverRetryCount           = 0;
            this.enableEndpointDiscovery      = enableEndpointDiscovery;
            this.sessionTokenRetryCount       = 0;
            this.canUseMultipleWriteLocations = false;
        }
        public BatchAsyncContainerExecutor(
            ContainerInternal cosmosContainer,
            CosmosClientContext cosmosClientContext,
            int maxServerRequestOperationCount,
            int maxServerRequestBodyLength)
        {
            if (maxServerRequestOperationCount < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(maxServerRequestOperationCount));
            }

            if (maxServerRequestBodyLength < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(maxServerRequestBodyLength));
            }

            this.cosmosContainer                = cosmosContainer ?? throw new ArgumentNullException(nameof(cosmosContainer));
            this.cosmosClientContext            = cosmosClientContext;
            this.maxServerRequestBodyLength     = maxServerRequestBodyLength;
            this.maxServerRequestOperationCount = maxServerRequestOperationCount;
            this.timerWheel   = TimerWheel.CreateTimerWheel(BatchAsyncContainerExecutor.TimerWheelResolution, BatchAsyncContainerExecutor.TimerWheelBucketCount);
            this.retryOptions = cosmosClientContext.ClientOptions.GetConnectionPolicy().RetryOptions;
        }
示例#4
0
 /// <summary>
 /// Initialize the instance of the RetryPolicy class
 /// </summary>
 public RetryPolicy(GlobalEndpointManager globalEndpointManager, ConnectionPolicy connectionPolicy)
 {
     this.enableEndpointDiscovery = connectionPolicy.EnableEndpointDiscovery;
     this.globalEndpointManager   = globalEndpointManager;
     this.retryOptions            = connectionPolicy.RetryOptions;
 }