RSFlowControl 1.0.1

dotnet add package RSFlowControl --version 1.0.1
                    
NuGet\Install-Package RSFlowControl -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RSFlowControl" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RSFlowControl" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RSFlowControl" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RSFlowControl --version 1.0.1
                    
#r "nuget: RSFlowControl, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RSFlowControl@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RSFlowControl&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=RSFlowControl&version=1.0.1
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
1.0.1 189 7/10/2025
1.0.0 134 7/10/2025