Soenneker.Utils.RateLimiting.Executor 11.0.646

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Utils.RateLimiting.Executor --version 11.0.646
                    
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 11.0.646
                    
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="Soenneker.Utils.RateLimiting.Executor" Version="11.0.646" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.RateLimiting.Executor" Version="11.0.646" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.RateLimiting.Executor" />
                    
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 Soenneker.Utils.RateLimiting.Executor --version 11.0.646
                    
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 11.0.646"
                    
#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 Soenneker.Utils.RateLimiting.Executor@11.0.646
                    
#: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=Soenneker.Utils.RateLimiting.Executor&version=11.0.646
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=11.0.646
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Utils.RateLimiting.Executor

Serializes delegate execution and enforces a minimum quiet interval after each completed attempt.

Installation

dotnet add package Soenneker.Utils.RateLimiting.Executor

Usage

using Soenneker.Utils.RateLimiting.Executor;

await using var executor = new RateLimitingExecutor(TimeSpan.FromSeconds(2));

ApiResponse response = await executor.Execute(
    async cancellationToken => await apiClient.Send(cancellationToken),
    cancellationToken);

Concurrent callers wait for the same lock. One delegate runs at a time, and the next delegate does not start until the configured interval has elapsed after the previous delegate completed. A five-second delegate with a two-second interval therefore makes the next start at least seven seconds after the previous start. This is not a token bucket, a concurrency limiter, or a background queue; each caller waits for its own delegate.

The interval is recorded after every delegate that starts, including one that throws or observes cancellation, so failures cannot bypass throttling. A call canceled while waiting for the lock or interval never invokes its delegate and does not move the timestamp. Delegate exceptions and cancellation propagate to that caller.

Delegate forms

  • Execute(...) accepts ValueTask, result-returning ValueTask, and synchronous delegates.
  • ExecuteTask(...) accepts Task and result-returning Task delegates.
  • Overloads with TArg pass state without requiring the caller to capture a closure.

The synchronous overloads block while waiting for both the lock and interval; use an asynchronous overload in request or UI paths. The executor links each caller token with its own lifetime token and passes the linked token into the delegate. A delegate that ignores cancellation cannot be forcibly interrupted.

Cancellation and disposal

executor.CancelExecution();

CancelExecution is terminal: it cancels the current token and all pending and future calls on that executor. It is not a pause/reset operation. Dispose or asynchronously dispose the executor when its lifetime ends; disposal also requests cancellation. Do not start new calls concurrently with disposal.

For dependency-injection scenarios that need keyed shared executors, see Soenneker.Utils.RateLimiting.Factory.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Utils.RateLimiting.Executor:

Package Downloads
Soenneker.Utils.RateLimiting.Factory

An async thread-safe singleton dictionary for Soenneker.Utils.RateLimiting.Executors, designed to manage the rate at which tasks are executed.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.660 57 11/18/2026
11.0.658 59 11/18/2026
11.0.654 351 11/11/2026
11.0.653 118 11/11/2026
11.0.652 138 11/11/2026
11.0.650 121 11/11/2026
11.0.648 112 11/11/2026
11.0.647 174 11/10/2026
11.0.646 379 11/3/2026
11.0.645 102 11/3/2026
11.0.643 306 10/26/2026
11.0.642 104 10/26/2026
11.0.641 138 10/26/2026
11.0.640 126 10/26/2026
11.0.639 98 10/26/2026
11.0.638 97 10/26/2026
4.0.637 569 10/15/2026
4.0.636 96 10/15/2026
4.0.635 131 10/14/2026
4.0.632 157 10/14/2026
Loading failed

Updated Multiple NuGet packages