Soenneker.Utils.RateLimiting.Executor 4.0.573

Prefix Reserved
dotnet add package Soenneker.Utils.RateLimiting.Executor --version 4.0.573
                    
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 4.0.573
                    
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="4.0.573" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.RateLimiting.Executor" Version="4.0.573" />
                    
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 4.0.573
                    
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 4.0.573"
                    
#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@4.0.573
                    
#: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=4.0.573
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=4.0.573
                    
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 net10.0 is compatible.  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.

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
4.0.573 0 8/31/2026
4.0.572 27 8/31/2026
4.0.571 49 8/31/2026
4.0.570 32 8/30/2026
4.0.569 32 8/30/2026
4.0.568 66 8/30/2026
4.0.567 66 8/30/2026
4.0.566 90 8/30/2026
4.0.565 92 8/29/2026
4.0.564 66 8/29/2026
4.0.563 32 8/29/2026
4.0.562 209 8/26/2026
4.0.561 108 8/26/2026
4.0.560 812 8/12/2026
4.0.559 375 8/8/2026
4.0.558 222 8/8/2026
4.0.557 532 7/29/2026
4.0.556 182 7/28/2026
4.0.555 227 7/28/2026
4.0.554 99 7/28/2026
Loading failed

Update dependency Soenneker.Asyncs.Locks to 4.0.74 (#1117)