1 write to _options
System.Threading.RateLimiting (1)
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (1)
72
_options
= new TokenBucketRateLimiterOptions
30 references to _options
System.Threading.RateLimiting (30)
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (30)
40
public override bool IsAutoReplenishing =>
_options
.AutoReplenishment;
43
public override TimeSpan ReplenishmentPeriod =>
_options
.ReplenishmentPeriod;
87
if (
_options
.AutoReplenishment)
89
_renewTimer = new Timer(Replenish, this,
_options
.ReplenishmentPeriod,
_options
.ReplenishmentPeriod);
110
if (tokenCount >
_options
.TokenLimit)
112
throw new ArgumentOutOfRangeException(nameof(tokenCount), tokenCount, SR.Format(SR.TokenLimitExceeded, tokenCount,
_options
.TokenLimit));
144
if (tokenCount >
_options
.TokenLimit)
146
throw new ArgumentOutOfRangeException(nameof(tokenCount), tokenCount, SR.Format(SR.TokenLimitExceeded, tokenCount,
_options
.TokenLimit));
167
Debug.Assert(
_options
.QueueLimit >= _queueCount);
168
if (
_options
.QueueLimit - _queueCount < tokenCount)
170
if (
_options
.QueueProcessingOrder == QueueProcessingOrder.NewestFirst && tokenCount <=
_options
.QueueLimit)
198
while (
_options
.QueueLimit - _queueCount < tokenCount);
211
Debug.Assert(_queueCount <=
_options
.QueueLimit);
222
Debug.Assert(
_options
.TokensPerPeriod > 0);
223
int replenishPeriods = Math.Max(replenishAmount /
_options
.TokensPerPeriod, 1);
225
return new TokenBucketLease(false, TimeSpan.FromTicks(
_options
.ReplenishmentPeriod.Ticks * replenishPeriods));
245
if (_queueCount == 0 || (_queueCount > 0 &&
_options
.QueueProcessingOrder == QueueProcessingOrder.NewestFirst))
269
if (
_options
.AutoReplenishment)
300
if (_tokenCount ==
_options
.TokenLimit)
308
if (
_options
.AutoReplenishment)
310
add =
_options
.TokensPerPeriod;
317
_tokenCount = Math.Min(
_options
.TokenLimit, _tokenCount + add);
324
Debug.Assert(_tokenCount <=
_options
.TokenLimit);
328
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst
337
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst
346
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst
384
if (_tokenCount ==
_options
.TokenLimit)
411
RequestRegistration next =
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst