1 write to _options
System.Threading.RateLimiting (1)
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (1)
73
_options
= new TokenBucketRateLimiterOptions
30 references to _options
System.Threading.RateLimiting (30)
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (30)
41
public override bool IsAutoReplenishing =>
_options
.AutoReplenishment;
44
public override TimeSpan ReplenishmentPeriod =>
_options
.ReplenishmentPeriod;
88
if (
_options
.AutoReplenishment)
90
_renewTimer = new Timer(Replenish, this,
_options
.ReplenishmentPeriod,
_options
.ReplenishmentPeriod);
111
if (tokenCount >
_options
.TokenLimit)
113
throw new ArgumentOutOfRangeException(nameof(tokenCount), tokenCount, SR.Format(SR.TokenLimitExceeded, tokenCount,
_options
.TokenLimit));
145
if (tokenCount >
_options
.TokenLimit)
147
throw new ArgumentOutOfRangeException(nameof(tokenCount), tokenCount, SR.Format(SR.TokenLimitExceeded, tokenCount,
_options
.TokenLimit));
168
Debug.Assert(
_options
.QueueLimit >= _queueCount);
169
if (
_options
.QueueLimit - _queueCount < tokenCount)
171
if (
_options
.QueueProcessingOrder == QueueProcessingOrder.NewestFirst && tokenCount <=
_options
.QueueLimit)
199
while (
_options
.QueueLimit - _queueCount < tokenCount);
212
Debug.Assert(_queueCount <=
_options
.QueueLimit);
223
Debug.Assert(
_options
.TokensPerPeriod > 0);
224
int replenishPeriods = Math.Max(replenishAmount /
_options
.TokensPerPeriod, 1);
226
return new TokenBucketLease(false, TimeSpan.FromTicks(
_options
.ReplenishmentPeriod.Ticks * replenishPeriods));
246
if (_queueCount == 0 || (_queueCount > 0 &&
_options
.QueueProcessingOrder == QueueProcessingOrder.NewestFirst))
270
if (
_options
.AutoReplenishment)
301
if (_tokenCount ==
_options
.TokenLimit)
309
if (
_options
.AutoReplenishment)
311
add =
_options
.TokensPerPeriod;
318
_tokenCount = Math.Min(
_options
.TokenLimit, _tokenCount + add);
325
Debug.Assert(_tokenCount <=
_options
.TokenLimit);
329
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst
338
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst
347
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst
385
if (_tokenCount ==
_options
.TokenLimit)
412
RequestRegistration next =
_options
.QueueProcessingOrder == QueueProcessingOrder.OldestFirst