public BatchAsyncContainerExecutor(
            ContainerInternal cosmosContainer,
            CosmosClientContext cosmosClientContext,
            int maxServerRequestOperationCount,
            int maxServerRequestBodyLength)
        {
            if (cosmosContainer == null)
            {
                throw new ArgumentNullException(nameof(cosmosContainer));
            }

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

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

            this.cosmosContainer                = cosmosContainer;
            this.cosmosClientContext            = cosmosClientContext;
            this.maxServerRequestBodyLength     = maxServerRequestBodyLength;
            this.maxServerRequestOperationCount = maxServerRequestOperationCount;
            this.timerWheel   = TimerWheel.CreateTimerWheel(BatchAsyncContainerExecutor.TimerWheelResolution, BatchAsyncContainerExecutor.TimerWheelBucketCount);
            this.retryOptions = cosmosClientContext.ClientOptions.GetConnectionPolicy().RetryOptions;
        }
Пример #2
0
        public async Task TenK_WithTimerWheel()
        {
            TimerWheel  wheel  = TimerWheel.CreateTimerWheel(TimerWheelBenchmark.resolution, 20);
            List <Task> timers = new List <Task>(this.timeouts.Count);

            for (int i = 0; i < this.timeouts.Count; i++)
            {
                SimpleTimerWheel.TimerWheelTimer timer = wheel.CreateTimer(TimeSpan.FromMilliseconds(this.timeouts[i]));
                timers.Add(timer.StartTimerAsync());
            }

            await Task.WhenAll(timers);

            wheel.Dispose();
        }
Пример #3
0
 public void CreatesTimerWheel()
 {
     using TimerWheel wheel = TimerWheel.CreateTimerWheel(TimeSpan.FromMilliseconds(50), 1);
     Assert.IsNotNull(wheel);
 }
Пример #4
0
 public TimerWheelBenchmark()
 {
     this.timeouts  = TimerUtilities.GenerateTimeoutList(10000, 1000, 50);
     this.mainWheel = TimerWheel.CreateTimerWheel(TimerWheelBenchmark.resolution, 20);
 }
Пример #5
0
 public void CreatesTimerWheel()
 {
     Assert.IsNotNull(TimerWheel.CreateTimerWheel(TimeSpan.FromMilliseconds(50), 1));
 }
 public TimerWheelBenchmark()
 {
     this.timeouts  = TimerUtilities.GenerateTimeoutList(10000, 10000, 1000);
     this.mainWheel = TimerWheel.CreateTimerWheel(TimeSpan.FromMilliseconds(1000), 10);
     this.timerPool = new TimerPool(1);
 }