-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
area-System.ThreadinguntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Description
Hello!
I found a few bugs in the class System.Threading.RateLimiting.ChainedRateLimiter
- Implemenration of IdleDuration
If at least one IdleDuration object is non-null, a non-null value will be returned always. This will clear the entire chain in DefaultPartitionedRateLimiter.Heartbeat. Even if there are active limiters with nullable idleDuration.
public override TimeSpan? IdleDuration
{
get
{
ThrowIfDisposed();
TimeSpan? lowestIdleDuration = null;
foreach (RateLimiter limiter in _limiters)
{
if (limiter.IdleDuration is { } idleDuration)
{
if (lowestIdleDuration is null || idleDuration < lowestIdleDuration)
{
lowestIdleDuration = idleDuration;
}
}
}
return lowestIdleDuration;
}
}
- ChainedRateLimiter not implements ReplenishingRateLimiter
Because of this, the TryReplenish method will not be called for the chain of child objects.
See DefaultPartitionedRateLimiter.Heartbeat
Reproduction Steps
I tried to use this class and caught the described bugs.
Expected behavior
Code without bugs
Actual behavior
Code without bugs
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.ThreadinguntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner