Soenneker.Utils.RateLimiting.Executor 3.0.103

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 3.0.103                
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 3.0.103                
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="3.0.103" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Utils.RateLimiting.Executor --version 3.0.103                
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 3.0.103"                
#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=3.0.103

// Install Soenneker.Utils.RateLimiting.Executor as a Cake Tool
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=3.0.103                

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

A thread-safe utility designed to manage the rate at which tasks are executed, ensuring they are not run more frequently than a specified interval.

RateLimitingExecutor is ideal for interacting with rate-limited APIs or throttling the execution of resource-intensive tasks.

Sequential Execution

Tasks, ValueTasks, and Actions are executed one at a time. If the defined interval between executions has passed, the task runs immediately; otherwise, it waits until the interval elapses before proceeding.

⚠️ Important Notes:

  • This is not a background queue processor. Each method awaits the result of the asynchronous operation before continuing.

  • Asynchronous methods will not block the calling thread, but synchronous methods will block execution until it completes.

Want to use this with dependency injection?

Check out the singleton factory implementation: Soenneker.Utils.RateLimiting.Factory

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 Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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
3.0.222 0 1/13/2025
3.0.221 29 1/13/2025
3.0.220 20 1/13/2025
3.0.219 18 1/13/2025
3.0.218 82 1/12/2025
3.0.217 70 1/11/2025
3.0.216 49 1/11/2025
3.0.215 58 1/11/2025
3.0.214 31 1/11/2025
3.0.213 57 1/10/2025
3.0.212 36 1/10/2025
3.0.211 31 1/10/2025
3.0.210 31 1/10/2025
3.0.209 96 1/10/2025
3.0.208 35 1/10/2025
3.0.207 35 1/10/2025
3.0.206 288 1/3/2025
3.0.205 95 1/3/2025
3.0.204 136 1/3/2025
3.0.203 91 1/3/2025
3.0.202 169 1/2/2025
3.0.201 71 1/2/2025
3.0.200 68 1/2/2025
3.0.199 153 1/2/2025
3.0.198 67 1/2/2025
3.0.197 71 1/2/2025
3.0.196 383 1/1/2025
3.0.195 160 1/1/2025
3.0.194 92 1/1/2025
3.0.193 108 1/1/2025
3.0.192 195 1/1/2025
3.0.191 85 1/1/2025
3.0.190 90 1/1/2025
3.0.189 96 12/31/2024
3.0.188 84 12/31/2024
3.0.187 87 12/31/2024
3.0.186 88 12/31/2024
3.0.185 81 12/31/2024
3.0.184 140 12/31/2024
3.0.183 93 12/31/2024
3.0.182 378 12/31/2024
3.0.181 76 12/31/2024
3.0.180 238 12/31/2024
3.0.179 139 12/31/2024
3.0.178 81 12/31/2024
3.0.177 83 12/31/2024
3.0.176 82 12/31/2024
3.0.175 74 12/31/2024
3.0.174 103 12/30/2024
3.0.173 340 12/28/2024
3.0.172 100 12/28/2024
3.0.171 139 12/27/2024
3.0.170 82 12/27/2024
3.0.169 410 12/24/2024
3.0.168 179 12/24/2024
3.0.167 109 12/24/2024
3.0.166 87 12/24/2024
3.0.165 172 12/24/2024
3.0.164 77 12/24/2024
3.0.163 169 12/24/2024
3.0.162 71 12/24/2024
3.0.161 114 12/24/2024
3.0.160 89 12/23/2024
3.0.159 146 12/23/2024
3.0.158 160 12/23/2024
3.0.157 84 12/23/2024
3.0.156 255 12/23/2024
3.0.155 101 12/23/2024
3.0.154 242 12/22/2024
3.0.153 83 12/22/2024
3.0.152 80 12/22/2024
3.0.151 193 12/22/2024
3.0.150 87 12/22/2024
3.0.149 82 12/22/2024
3.0.148 77 12/22/2024
3.0.147 261 12/22/2024
3.0.146 84 12/22/2024
3.0.145 90 12/22/2024
3.0.144 82 12/22/2024
3.0.143 247 12/21/2024
3.0.142 82 12/21/2024
3.0.141 93 12/21/2024
3.0.140 78 12/21/2024
3.0.139 83 12/21/2024
3.0.138 76 12/21/2024
3.0.137 79 12/21/2024
3.0.136 84 12/21/2024
3.0.135 269 12/21/2024
3.0.134 165 12/21/2024
3.0.133 79 12/21/2024
3.0.132 82 12/21/2024
3.0.131 72 12/21/2024
3.0.130 226 12/21/2024
3.0.129 80 12/21/2024
3.0.128 130 12/20/2024
3.0.127 74 12/20/2024
3.0.126 156 12/20/2024
3.0.125 79 12/20/2024
3.0.124 180 12/20/2024
3.0.123 155 12/20/2024
3.0.122 83 12/20/2024
3.0.121 157 12/20/2024
3.0.120 181 12/19/2024
3.0.119 155 12/19/2024
3.0.118 89 12/19/2024
3.0.117 135 12/19/2024
3.0.116 82 12/18/2024
3.0.115 130 12/18/2024
3.0.114 187 12/17/2024
3.0.113 99 12/17/2024
3.0.112 62 12/17/2024
3.0.111 198 12/16/2024
3.0.110 280 12/10/2024
3.0.109 81 12/10/2024
3.0.108 164 12/10/2024
3.0.107 83 12/9/2024
3.0.106 166 12/9/2024
3.0.105 198 12/9/2024
3.0.104 79 12/9/2024
3.0.103 281 12/7/2024
3.0.102 105 12/6/2024
3.0.101 96 12/6/2024
3.0.100 98 12/6/2024
3.0.99 101 12/6/2024
3.0.97 128 12/6/2024
3.0.96 109 12/6/2024
3.0.95 86 12/6/2024
3.0.94 86 12/6/2024
3.0.93 87 12/6/2024
3.0.92 87 12/6/2024
3.0.91 124 12/6/2024
3.0.90 115 12/5/2024
3.0.89 111 12/5/2024
3.0.88 665 12/5/2024
3.0.87 126 12/5/2024
3.0.86 132 12/5/2024
3.0.85 175 12/5/2024
3.0.84 109 12/4/2024
3.0.83 134 12/4/2024
3.0.82 190 12/4/2024
3.0.81 178 12/4/2024
3.0.80 160 12/4/2024
3.0.79 89 12/3/2024
3.0.78 183 12/3/2024
3.0.77 184 12/3/2024
3.0.76 143 12/3/2024
3.0.75 77 12/3/2024
3.0.74 130 12/3/2024
3.0.73 74 12/3/2024
3.0.72 346 12/2/2024
3.0.71 138 12/2/2024
3.0.70 156 12/2/2024
3.0.69 83 12/2/2024
3.0.68 159 12/2/2024
3.0.67 203 12/1/2024
3.0.66 85 12/1/2024
3.0.65 241 12/1/2024
3.0.64 120 12/1/2024
3.0.63 192 11/29/2024
3.0.62 160 11/29/2024
3.0.61 249 11/21/2024
3.0.60 99 11/21/2024
3.0.59 249 11/20/2024
3.0.58 91 11/20/2024
3.0.57 113 11/20/2024
3.0.56 90 11/20/2024
3.0.55 90 11/20/2024
3.0.54 102 11/20/2024
3.0.53 95 11/19/2024
3.0.52 89 11/19/2024
3.0.51 85 11/19/2024
3.0.50 371 11/19/2024
3.0.49 79 11/19/2024
3.0.48 298 11/19/2024
3.0.47 84 11/19/2024
3.0.46 88 11/19/2024
3.0.45 285 11/15/2024
3.0.44 129 11/14/2024
3.0.43 84 11/14/2024
3.0.42 83 11/14/2024
3.0.41 131 11/14/2024
3.0.40 97 11/14/2024
3.0.39 209 11/14/2024
3.0.38 306 11/14/2024
3.0.37 149 11/14/2024
3.0.36 86 11/14/2024
3.0.35 88 11/14/2024
3.0.34 133 11/14/2024
3.0.33 87 11/14/2024
3.0.32 186 11/14/2024
2.1.31 288 11/13/2024
2.1.30 175 11/13/2024
2.1.29 250 11/13/2024
2.1.28 138 11/12/2024
2.1.27 81 11/12/2024
2.1.26 641 11/9/2024
2.1.25 173 11/9/2024
2.1.24 334 11/8/2024
2.1.23 95 11/8/2024
2.1.22 87 11/8/2024
2.1.21 283 11/8/2024
2.1.20 227 11/8/2024
2.1.19 252 11/6/2024
2.1.18 324 11/1/2024
2.1.17 86 11/1/2024
2.1.16 313 11/1/2024
2.1.14 99 10/29/2024
2.1.13 250 10/29/2024
2.1.12 136 10/29/2024
2.1.11 407 10/29/2024
2.1.10 249 10/28/2024
2.1.9 87 10/28/2024
2.1.8 118 10/28/2024
2.1.7 351 10/26/2024
2.1.6 110 10/26/2024
2.1.5 255 10/22/2024
2.1.4 111 10/22/2024
2.1.3 88 10/22/2024
2.1.2 95 10/22/2024
2.1.1 115 10/22/2024