Soenneker.Utils.RateLimiting.Executor
4.0.571
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.RateLimiting.Executor --version 4.0.571
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 4.0.571
<PackageReference Include="Soenneker.Utils.RateLimiting.Executor" Version="4.0.571" />
<PackageVersion Include="Soenneker.Utils.RateLimiting.Executor" Version="4.0.571" />
<PackageReference Include="Soenneker.Utils.RateLimiting.Executor" />
paket add Soenneker.Utils.RateLimiting.Executor --version 4.0.571
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 4.0.571"
#:package Soenneker.Utils.RateLimiting.Executor@4.0.571
#addin nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=4.0.571
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=4.0.571
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(...)acceptsValueTask, result-returningValueTask, and synchronous delegates.ExecuteTask(...)acceptsTaskand result-returningTaskdelegates.- Overloads with
TArgpass 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 | Versions 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. |
-
net10.0
- Soenneker.Asyncs.Locks (>= 4.0.73)
- Soenneker.Extensions.ValueTask (>= 4.0.120)
- Soenneker.Utils.Delay (>= 4.0.83)
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.574 | 0 | 9/1/2026 |
| 4.0.573 | 30 | 8/31/2026 |
| 4.0.572 | 82 | 8/31/2026 |
| 4.0.571 | 58 | 8/31/2026 |
| 4.0.570 | 35 | 8/30/2026 |
| 4.0.569 | 35 | 8/30/2026 |
| 4.0.568 | 71 | 8/30/2026 |
| 4.0.567 | 72 | 8/30/2026 |
| 4.0.566 | 94 | 8/30/2026 |
| 4.0.565 | 94 | 8/29/2026 |
| 4.0.564 | 67 | 8/29/2026 |
| 4.0.563 | 32 | 8/29/2026 |
| 4.0.562 | 213 | 8/26/2026 |
| 4.0.561 | 111 | 8/26/2026 |
| 4.0.560 | 818 | 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 |
Update dependency Soenneker.Utils.Delay to 4.0.83 (#1114)