RSFlowControl 1.0.1
dotnet add package RSFlowControl --version 1.0.1
NuGet\Install-Package RSFlowControl -Version 1.0.1
<PackageReference Include="RSFlowControl" Version="1.0.1" />
<PackageVersion Include="RSFlowControl" Version="1.0.1" />
<PackageReference Include="RSFlowControl" />
paket add RSFlowControl --version 1.0.1
#r "nuget: RSFlowControl, 1.0.1"
#:package RSFlowControl@1.0.1
#addin nuget:?package=RSFlowControl&version=1.0.1
#tool nuget:?package=RSFlowControl&version=1.0.1
RSFlowControl
Scope
This package contains some utility classes that have zero dependencies and are concerned with flow control. When I implemented these, I could not find a simple availeble solution that fits my needs, so I implemented one.
LeakyBucket
This class is basically a rate limiter following the leaky bucket algorithm. It does not have to be disposed, uses minimal locking while being threadsafe.
using RSFlowControl;
int capacity = 10;
int maxLeaksPerHour = 600;
var rateLimiter = new LeakyBucket(capacity, maxLeaksPerHour);
if (rateLimiter.Leak())
// Do work
ProbabilityRamp
Probabilistic rate limiting/triggering
I use this one to occasionally make a bot trigger a reaction. The idea is that there is a chance to trigger, which increases over time, and when it does trigger, the timer is reset back to its initial value.
using RSFlowControl;
// 5% chance initially, ramping to 40% over 2 minutes
var ramp = new ProbabilityRamp(0.05, 0.4, TimeSpan.FromMinutes(2));
if (ramp.Check())
// Do work
// Get current probability without checking
double currentProb = ramp.CurrentChance;
// Reset the timer
ramp.Reset();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RSFlowControl:
Package | Downloads |
---|---|
RSMatrix
Simple text client implementation for the matrix.org chat protocol. |
GitHub repositories
This package is not used by any popular GitHub repositories.