Soenneker.Utils.RateLimiting.Executor 11.0.654

Prefix Reserved
dotnet add package Soenneker.Utils.RateLimiting.Executor --version 11.0.654
                    
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 11.0.654
                    
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.654" />
                    
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.654" />
                    
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.654
                    
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 11.0.654"
                    
#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.654
                    
#: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.654
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=11.0.654
                    
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.654 142 11/11/2026
11.0.653 99 11/11/2026
11.0.652 113 11/11/2026
11.0.650 102 11/11/2026
11.0.648 98 11/11/2026
11.0.647 152 11/10/2026
11.0.646 366 11/3/2026
11.0.645 99 11/3/2026
11.0.643 304 10/26/2026
11.0.642 103 10/26/2026
11.0.641 137 10/26/2026
11.0.640 124 10/26/2026
11.0.639 97 10/26/2026
11.0.638 96 10/26/2026
4.0.637 539 10/15/2026
4.0.636 94 10/15/2026
4.0.635 129 10/14/2026
4.0.632 156 10/14/2026
4.0.631 142 10/14/2026
4.0.630 135 10/14/2026
Loading failed

Update dependency Soenneker.Asyncs.Locks to 11.0.122 (#1255)