Soenneker.Utils.RateLimiting.Executor
2.1.1
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Soenneker.Utils.RateLimiting.Executor --version 2.1.1
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 2.1.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="Soenneker.Utils.RateLimiting.Executor" Version="2.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.RateLimiting.Executor --version 2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 2.1.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.
// Install Soenneker.Utils.RateLimiting.Executor as a Cake Addin #addin nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=2.1.1 // Install Soenneker.Utils.RateLimiting.Executor as a Cake Tool #tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Utils.RateLimiting.Executor
A thread-safe utility designed to manage the rate at which tasks are executed, ensuring that they are not run more frequently than a specified interval.
This can be particularly useful when interacting with rate-limited APIs or for throttling the execution of resource-intensive tasks.
Installation
dotnet add package Soenneker.Utils.RateLimiting.Executor
Example: Executing a Loop of Tasks with Rate Limiting
Below is an example demonstrating how to use the RateLimitingExecutor to execute a series of tasks while maintaining a rate limit.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Soenneker.Utils.RateLimiting.Executor;
public class Program
{
public static async Task Main(string[] args)
{
var rateLimitingExecutor = new RateLimitingExecutor(TimeSpan.FromSeconds(2));
for (int i = 0; i < 5; i++)
{
await rateLimitingExecutor.Execute(async ct =>
{
Console.WriteLine($"Executing Task {i + 1} at {DateTime.Now:HH:mm:ss}");
await Task.Delay(100); // Simulate some work
});
}
}
}
Console Output
Executing Task 1 at 14:00:00
Executing Task 2 at 14:00:02
Executing Task 3 at 14:00:04
Executing Task 4 at 14:00:06
Executing Task 5 at 14:00:08
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Nito.AsyncEx (>= 5.1.2)
- Soenneker.Extensions.Task (>= 2.1.65)
- Soenneker.Extensions.ValueTask (>= 2.1.50)
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 |
---|---|---|
2.1.20 | 0 | 11/8/2024 |
2.1.19 | 93 | 11/6/2024 |
2.1.18 | 249 | 11/1/2024 |
2.1.17 | 59 | 11/1/2024 |
2.1.16 | 287 | 11/1/2024 |
2.1.14 | 77 | 10/29/2024 |
2.1.13 | 227 | 10/29/2024 |
2.1.12 | 115 | 10/29/2024 |
2.1.11 | 384 | 10/29/2024 |
2.1.10 | 225 | 10/28/2024 |
2.1.9 | 61 | 10/28/2024 |
2.1.8 | 91 | 10/28/2024 |
2.1.7 | 327 | 10/26/2024 |
2.1.6 | 86 | 10/26/2024 |
2.1.5 | 232 | 10/22/2024 |
2.1.4 | 89 | 10/22/2024 |
2.1.3 | 64 | 10/22/2024 |
2.1.2 | 75 | 10/22/2024 |
2.1.1 | 91 | 10/22/2024 |