Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.Implementation.QuickPulse.Helpers.QuickPulseQuotaTracker.IncreaseQuota C# (CSharp) Method

IncreaseQuota() private method

private IncreaseQuota ( long seconds ) : void
seconds long
return void
        private void IncreaseQuota(long seconds)
        {
            var spin = new SpinWait();

            while (true)
            {
                float originalValue = Interlocked.CompareExchange(ref this.currentQuota, 0, 0);

                float delta = Math.Min(this.inputStreamRatePerSec * seconds, this.maxQuota - originalValue);

                if (Interlocked.CompareExchange(ref this.currentQuota, originalValue + delta, originalValue) == originalValue)
                {
                    break;
                }

                spin.SpinOnce();
            }
        }