Soenneker.Utils.RateLimiting.Executor 3.0.211

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.211                
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 3.0.211                
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.211" />                
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.211                
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 3.0.211"                
#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.211

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

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.267 0 1/28/2025
3.0.266 0 1/28/2025
3.0.265 0 1/27/2025
3.0.264 11 1/27/2025
3.0.263 14 1/27/2025
3.0.262 14 1/27/2025
3.0.261 33 1/27/2025
3.0.260 34 1/27/2025
3.0.259 88 1/26/2025
3.0.258 44 1/26/2025
3.0.257 43 1/26/2025
3.0.256 28 1/26/2025
3.0.255 72 1/25/2025
3.0.254 89 1/25/2025
3.0.253 33 1/25/2025
3.0.252 32 1/25/2025
3.0.251 30 1/25/2025
3.0.250 73 1/25/2025
3.0.249 57 1/24/2025
3.0.248 5 1/24/2025
3.0.247 44 1/24/2025
3.0.246 53 1/24/2025
3.0.245 100 1/24/2025
3.0.244 67 1/23/2025
3.0.243 148 1/21/2025
3.0.242 69 1/21/2025
3.0.241 113 1/21/2025
3.0.240 73 1/21/2025
3.0.239 62 1/21/2025
3.0.238 218 1/21/2025
3.0.237 67 1/21/2025
3.0.236 60 1/21/2025
3.0.235 59 1/21/2025
3.0.234 61 1/21/2025
3.0.233 62 1/20/2025
3.0.232 78 1/20/2025
3.0.231 537 1/20/2025
3.0.230 69 1/20/2025
3.0.229 60 1/20/2025
3.0.228 215 1/20/2025
3.0.227 1,779 1/14/2025
3.0.226 33 1/14/2025
3.0.225 40 1/14/2025
3.0.224 58 1/14/2025
3.0.223 139 1/13/2025
3.0.222 109 1/13/2025
3.0.221 86 1/13/2025
3.0.220 60 1/13/2025
3.0.219 51 1/13/2025
3.0.218 146 1/12/2025
3.0.217 109 1/11/2025
3.0.216 87 1/11/2025
3.0.215 99 1/11/2025
3.0.214 63 1/11/2025
3.0.213 93 1/10/2025
3.0.212 63 1/10/2025
3.0.211 60 1/10/2025
3.0.210 62 1/10/2025
3.0.209 153 1/10/2025
3.0.208 68 1/10/2025
3.0.207 67 1/10/2025
3.0.206 481 1/3/2025
3.0.205 97 1/3/2025
3.0.204 138 1/3/2025
3.0.203 93 1/3/2025
3.0.202 171 1/2/2025
3.0.201 73 1/2/2025
3.0.200 70 1/2/2025
3.0.199 155 1/2/2025
3.0.198 69 1/2/2025
3.0.197 73 1/2/2025
3.0.196 385 1/1/2025
3.0.195 162 1/1/2025
3.0.194 94 1/1/2025
3.0.193 110 1/1/2025
3.0.192 197 1/1/2025
3.0.191 87 1/1/2025
3.0.190 92 1/1/2025
3.0.189 98 12/31/2024
3.0.188 86 12/31/2024
3.0.187 89 12/31/2024
3.0.186 90 12/31/2024
3.0.185 83 12/31/2024
3.0.184 142 12/31/2024
3.0.183 95 12/31/2024
3.0.182 380 12/31/2024
3.0.181 78 12/31/2024
3.0.180 240 12/31/2024
3.0.179 141 12/31/2024
3.0.178 83 12/31/2024
3.0.177 85 12/31/2024
3.0.176 84 12/31/2024
3.0.175 76 12/31/2024
3.0.174 105 12/30/2024
3.0.173 342 12/28/2024
3.0.172 102 12/28/2024
3.0.171 141 12/27/2024
3.0.170 84 12/27/2024
3.0.169 412 12/24/2024
3.0.168 181 12/24/2024
3.0.167 111 12/24/2024
3.0.166 90 12/24/2024
3.0.165 174 12/24/2024
3.0.164 79 12/24/2024
3.0.163 171 12/24/2024
3.0.162 73 12/24/2024
3.0.161 116 12/24/2024
3.0.160 91 12/23/2024
3.0.159 148 12/23/2024
3.0.158 162 12/23/2024
3.0.157 86 12/23/2024
3.0.156 259 12/23/2024
3.0.155 105 12/23/2024
3.0.154 244 12/22/2024
3.0.153 85 12/22/2024
3.0.152 82 12/22/2024
3.0.151 195 12/22/2024
3.0.150 89 12/22/2024
3.0.149 84 12/22/2024
3.0.148 79 12/22/2024
3.0.147 263 12/22/2024
3.0.146 86 12/22/2024
3.0.145 94 12/22/2024
3.0.144 84 12/22/2024
3.0.143 249 12/21/2024
3.0.142 84 12/21/2024
3.0.141 95 12/21/2024
3.0.140 80 12/21/2024
3.0.139 85 12/21/2024
3.0.138 78 12/21/2024
3.0.137 81 12/21/2024
3.0.136 86 12/21/2024
3.0.135 271 12/21/2024
3.0.134 167 12/21/2024
3.0.133 81 12/21/2024
3.0.132 84 12/21/2024
3.0.131 74 12/21/2024
3.0.130 229 12/21/2024
3.0.129 83 12/21/2024
3.0.128 133 12/20/2024
3.0.127 76 12/20/2024
3.0.126 158 12/20/2024
3.0.125 81 12/20/2024
3.0.124 182 12/20/2024
3.0.123 157 12/20/2024
3.0.122 85 12/20/2024
3.0.121 159 12/20/2024
3.0.120 183 12/19/2024
3.0.119 157 12/19/2024
3.0.118 91 12/19/2024
3.0.117 137 12/19/2024
3.0.116 84 12/18/2024
3.0.115 132 12/18/2024
3.0.114 189 12/17/2024
3.0.113 101 12/17/2024
3.0.112 64 12/17/2024
3.0.111 200 12/16/2024
3.0.110 282 12/10/2024
3.0.109 83 12/10/2024
3.0.108 166 12/10/2024
3.0.107 85 12/9/2024
3.0.106 168 12/9/2024
3.0.105 200 12/9/2024
3.0.104 81 12/9/2024
3.0.103 283 12/7/2024
3.0.102 107 12/6/2024
3.0.101 98 12/6/2024
3.0.100 100 12/6/2024
3.0.99 103 12/6/2024
3.0.97 130 12/6/2024
3.0.96 111 12/6/2024
3.0.95 88 12/6/2024
3.0.94 88 12/6/2024
3.0.93 91 12/6/2024
3.0.92 91 12/6/2024
3.0.91 126 12/6/2024
3.0.90 117 12/5/2024
3.0.89 114 12/5/2024
3.0.88 669 12/5/2024
3.0.87 128 12/5/2024
3.0.86 134 12/5/2024
3.0.85 179 12/5/2024
3.0.84 111 12/4/2024
3.0.83 136 12/4/2024
3.0.82 194 12/4/2024
3.0.81 180 12/4/2024
3.0.80 162 12/4/2024
3.0.79 91 12/3/2024
3.0.78 185 12/3/2024
3.0.77 186 12/3/2024
3.0.76 147 12/3/2024
3.0.75 79 12/3/2024
3.0.74 132 12/3/2024
3.0.73 78 12/3/2024
3.0.72 350 12/2/2024
3.0.71 140 12/2/2024
3.0.70 158 12/2/2024
3.0.69 85 12/2/2024
3.0.68 161 12/2/2024
3.0.67 205 12/1/2024
3.0.66 87 12/1/2024
3.0.65 243 12/1/2024
3.0.64 122 12/1/2024
3.0.63 194 11/29/2024
3.0.62 164 11/29/2024
3.0.61 251 11/21/2024
3.0.60 101 11/21/2024
3.0.59 251 11/20/2024
3.0.58 93 11/20/2024
3.0.57 115 11/20/2024
3.0.56 92 11/20/2024
3.0.55 92 11/20/2024
3.0.54 104 11/20/2024
3.0.53 99 11/19/2024
3.0.52 91 11/19/2024
3.0.51 87 11/19/2024
3.0.50 376 11/19/2024
3.0.49 81 11/19/2024
3.0.48 300 11/19/2024
3.0.47 86 11/19/2024
3.0.46 90 11/19/2024
3.0.45 287 11/15/2024
3.0.44 133 11/14/2024
3.0.43 88 11/14/2024
3.0.42 85 11/14/2024
3.0.41 133 11/14/2024
3.0.40 99 11/14/2024
3.0.39 211 11/14/2024
3.0.38 308 11/14/2024
3.0.37 153 11/14/2024
3.0.36 88 11/14/2024
3.0.35 90 11/14/2024
3.0.34 135 11/14/2024
3.0.33 91 11/14/2024
3.0.32 188 11/14/2024
2.1.31 290 11/13/2024
2.1.30 177 11/13/2024
2.1.29 253 11/13/2024
2.1.28 140 11/12/2024
2.1.27 83 11/12/2024
2.1.26 643 11/9/2024
2.1.25 175 11/9/2024
2.1.24 336 11/8/2024
2.1.23 97 11/8/2024
2.1.22 90 11/8/2024
2.1.21 285 11/8/2024
2.1.20 229 11/8/2024
2.1.19 256 11/6/2024
2.1.18 326 11/1/2024
2.1.17 88 11/1/2024
2.1.16 315 11/1/2024
2.1.14 103 10/29/2024
2.1.13 252 10/29/2024
2.1.12 140 10/29/2024
2.1.11 409 10/29/2024
2.1.10 253 10/28/2024
2.1.9 92 10/28/2024
2.1.8 122 10/28/2024
2.1.7 353 10/26/2024
2.1.6 112 10/26/2024
2.1.5 257 10/22/2024
2.1.4 113 10/22/2024
2.1.3 90 10/22/2024
2.1.2 99 10/22/2024
2.1.1 117 10/22/2024