Soenneker.Utils.RateLimiting.Executor 3.0.362

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.362
                    
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 3.0.362
                    
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.362" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.RateLimiting.Executor" Version="3.0.362" />
                    
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 3.0.362
                    
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 3.0.362"
                    
#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.
#addin nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=3.0.362
                    
Install Soenneker.Utils.RateLimiting.Executor as a Cake Addin
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=3.0.362
                    
Install Soenneker.Utils.RateLimiting.Executor 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 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.  net10.0 was computed.  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
3.0.413 369 5/8/2025
3.0.412 140 5/7/2025
3.0.411 125 5/7/2025
3.0.410 414 5/5/2025
3.0.409 220 5/5/2025
3.0.408 127 5/5/2025
3.0.407 182 5/5/2025
3.0.406 135 5/5/2025
3.0.405 766 4/8/2025
3.0.404 147 4/8/2025
3.0.403 149 4/8/2025
3.0.402 410 4/8/2025
3.0.401 167 4/8/2025
3.0.400 151 4/8/2025
3.0.399 162 4/8/2025
3.0.398 149 4/8/2025
3.0.397 473 4/7/2025
3.0.396 159 4/7/2025
3.0.395 212 4/7/2025
3.0.394 315 4/7/2025
3.0.393 163 4/7/2025
3.0.392 161 4/7/2025
3.0.391 148 4/6/2025
3.0.390 150 4/6/2025
3.0.389 129 4/6/2025
3.0.388 121 4/6/2025
3.0.387 104 4/6/2025
3.0.386 98 4/6/2025
3.0.385 95 4/6/2025
3.0.384 99 4/6/2025
3.0.383 102 4/5/2025
3.0.382 79 4/5/2025
3.0.381 70 4/5/2025
3.0.380 79 4/5/2025
3.0.379 79 4/5/2025
3.0.378 77 4/5/2025
3.0.377 77 4/5/2025
3.0.376 96 4/4/2025
3.0.375 91 4/4/2025
3.0.374 1,343 4/3/2025
3.0.373 252 4/1/2025
3.0.372 185 4/1/2025
3.0.371 213 4/1/2025
3.0.370 187 3/31/2025
3.0.369 146 3/31/2025
3.0.368 213 3/31/2025
3.0.367 293 3/31/2025
3.0.366 165 3/29/2025
3.0.365 80 3/29/2025
3.0.364 110 3/29/2025
3.0.363 661 3/25/2025
3.0.362 485 3/25/2025
3.0.361 300 3/21/2025
3.0.360 155 3/21/2025
3.0.359 410 3/18/2025
3.0.358 226 3/18/2025
3.0.357 205 3/15/2025
3.0.356 58 3/15/2025
3.0.355 402 3/12/2025
3.0.354 180 3/12/2025
3.0.353 233 3/12/2025
3.0.352 164 3/11/2025
3.0.351 306 3/11/2025
3.0.350 226 3/11/2025
3.0.349 148 3/11/2025
3.0.348 406 3/11/2025
3.0.347 365 3/7/2025
3.0.346 332 3/7/2025
3.0.345 324 3/2/2025
3.0.344 136 3/2/2025
3.0.343 134 3/2/2025
3.0.342 88 3/2/2025
3.0.341 95 3/2/2025
3.0.340 205 3/2/2025
3.0.339 203 3/1/2025
3.0.338 83 3/1/2025
3.0.337 84 3/1/2025
3.0.336 409 3/1/2025
3.0.335 115 3/1/2025
3.0.334 73 3/1/2025
3.0.333 193 3/1/2025
3.0.332 79 3/1/2025
3.0.331 77 3/1/2025
3.0.330 302 2/25/2025
3.0.329 131 2/25/2025
3.0.328 173 2/25/2025
3.0.327 198 2/25/2025
3.0.326 150 2/25/2025
3.0.325 372 2/23/2025
3.0.324 145 2/23/2025
3.0.323 85 2/22/2025
3.0.322 349 2/22/2025
3.0.321 177 2/22/2025
3.0.320 127 2/22/2025
3.0.319 188 2/22/2025
3.0.318 88 2/21/2025
3.0.317 211 2/21/2025
3.0.316 262 2/21/2025
3.0.315 314 2/19/2025
3.0.314 123 2/19/2025
3.0.313 124 2/19/2025
3.0.312 101 2/18/2025
3.0.311 306 2/18/2025
3.0.310 162 2/18/2025
3.0.309 93 2/18/2025
3.0.308 445 2/14/2025
3.0.307 91 2/14/2025
3.0.306 169 2/13/2025
3.0.305 395 2/12/2025
3.0.304 112 2/12/2025
3.0.303 183 2/12/2025
3.0.302 185 2/11/2025
3.0.301 174 2/11/2025
3.0.300 302 2/11/2025
3.0.299 240 2/11/2025
3.0.298 91 2/11/2025
3.0.297 176 2/11/2025
3.0.296 193 2/10/2025
3.0.295 142 2/10/2025
3.0.294 190 2/10/2025
3.0.293 92 2/10/2025
3.0.292 95 2/10/2025
3.0.291 378 2/9/2025
3.0.290 106 2/8/2025
3.0.289 81 2/8/2025
3.0.288 85 2/8/2025
3.0.287 93 2/8/2025
3.0.286 311 2/8/2025
3.0.285 106 2/7/2025
3.0.284 138 2/7/2025
3.0.283 254 2/7/2025
3.0.282 91 2/7/2025
3.0.281 85 2/7/2025
3.0.280 84 2/7/2025
3.0.279 134 2/7/2025
3.0.278 83 2/7/2025
3.0.277 98 2/7/2025
3.0.276 376 2/6/2025
3.0.275 249 2/5/2025
3.0.274 161 2/5/2025
3.0.273 92 2/5/2025
3.0.272 103 2/5/2025
3.0.271 237 2/5/2025
3.0.270 98 2/5/2025
3.0.269 92 2/5/2025
3.0.268 502 1/28/2025
3.0.267 87 1/28/2025
3.0.266 101 1/28/2025
3.0.265 317 1/27/2025
3.0.264 95 1/27/2025
3.0.263 78 1/27/2025
3.0.262 74 1/27/2025
3.0.261 142 1/27/2025
3.0.260 99 1/27/2025
3.0.259 274 1/26/2025
3.0.258 101 1/26/2025
3.0.257 94 1/26/2025
3.0.256 77 1/26/2025
3.0.255 169 1/25/2025
3.0.254 203 1/25/2025
3.0.253 82 1/25/2025
3.0.252 78 1/25/2025
3.0.251 77 1/25/2025
3.0.250 195 1/25/2025
3.0.249 370 1/24/2025
3.0.248 121 1/24/2025
3.0.247 188 1/24/2025
3.0.246 147 1/24/2025
3.0.245 251 1/24/2025
3.0.244 183 1/23/2025
3.0.243 255 1/21/2025
3.0.242 90 1/21/2025
3.0.241 167 1/21/2025
3.0.240 94 1/21/2025
3.0.239 80 1/21/2025
3.0.238 276 1/21/2025
3.0.237 87 1/21/2025
3.0.236 82 1/21/2025
3.0.235 78 1/21/2025
3.0.234 83 1/21/2025
3.0.233 81 1/20/2025
3.0.232 97 1/20/2025
3.0.231 567 1/20/2025
3.0.230 91 1/20/2025
3.0.229 80 1/20/2025
3.0.228 235 1/20/2025
3.0.227 1,819 1/14/2025
3.0.226 61 1/14/2025
3.0.225 76 1/14/2025
3.0.224 136 1/14/2025
3.0.223 183 1/13/2025
3.0.222 171 1/13/2025
3.0.221 122 1/13/2025
3.0.220 74 1/13/2025
3.0.219 65 1/13/2025
3.0.218 213 1/12/2025
3.0.217 153 1/11/2025
3.0.216 126 1/11/2025
3.0.215 131 1/11/2025
3.0.214 86 1/11/2025
3.0.213 128 1/10/2025
3.0.212 87 1/10/2025
3.0.211 79 1/10/2025
3.0.210 81 1/10/2025
3.0.209 227 1/10/2025
3.0.208 89 1/10/2025
3.0.207 87 1/10/2025
3.0.206 632 1/3/2025
3.0.205 115 1/3/2025
3.0.204 162 1/3/2025
3.0.203 111 1/3/2025
3.0.202 189 1/2/2025
3.0.201 92 1/2/2025
3.0.200 89 1/2/2025
3.0.199 173 1/2/2025
3.0.198 87 1/2/2025
3.0.197 91 1/2/2025
3.0.196 394 1/1/2025
3.0.195 170 1/1/2025
3.0.194 102 1/1/2025
3.0.193 120 1/1/2025
3.0.192 205 1/1/2025
3.0.191 95 1/1/2025
3.0.190 100 1/1/2025
3.0.189 106 12/31/2024
3.0.188 94 12/31/2024
3.0.187 98 12/31/2024
3.0.186 99 12/31/2024
3.0.185 91 12/31/2024
3.0.184 152 12/31/2024
3.0.183 104 12/31/2024
3.0.182 389 12/31/2024
3.0.181 88 12/31/2024
3.0.180 249 12/31/2024
3.0.179 148 12/31/2024
3.0.178 92 12/31/2024
3.0.177 96 12/31/2024
3.0.176 94 12/31/2024
3.0.175 86 12/31/2024
3.0.174 116 12/30/2024
3.0.173 350 12/28/2024
3.0.172 110 12/28/2024
3.0.171 150 12/27/2024
3.0.170 93 12/27/2024
3.0.169 420 12/24/2024
3.0.168 189 12/24/2024
3.0.167 120 12/24/2024
3.0.166 98 12/24/2024
3.0.165 183 12/24/2024
3.0.164 88 12/24/2024
3.0.163 177 12/24/2024
3.0.162 81 12/24/2024
3.0.161 124 12/24/2024
3.0.160 99 12/23/2024
3.0.159 158 12/23/2024
3.0.158 171 12/23/2024
3.0.157 95 12/23/2024
3.0.156 266 12/23/2024
3.0.155 111 12/23/2024
3.0.154 252 12/22/2024
3.0.153 93 12/22/2024
3.0.152 91 12/22/2024
3.0.151 203 12/22/2024
3.0.150 97 12/22/2024
3.0.149 93 12/22/2024
3.0.148 87 12/22/2024
3.0.147 272 12/22/2024
3.0.146 95 12/22/2024
3.0.145 104 12/22/2024
3.0.144 94 12/22/2024
3.0.143 258 12/21/2024
3.0.142 92 12/21/2024
3.0.141 104 12/21/2024
3.0.140 89 12/21/2024
3.0.139 93 12/21/2024
3.0.138 86 12/21/2024
3.0.137 89 12/21/2024
3.0.136 94 12/21/2024
3.0.135 280 12/21/2024
3.0.134 176 12/21/2024
3.0.133 89 12/21/2024
3.0.132 92 12/21/2024
3.0.131 82 12/21/2024
3.0.130 239 12/21/2024
3.0.129 90 12/21/2024
3.0.128 143 12/20/2024
3.0.127 85 12/20/2024
3.0.126 166 12/20/2024
3.0.125 89 12/20/2024
3.0.124 189 12/20/2024
3.0.123 167 12/20/2024
3.0.122 93 12/20/2024
3.0.121 166 12/20/2024
3.0.120 191 12/19/2024
3.0.119 167 12/19/2024
3.0.118 100 12/19/2024
3.0.117 146 12/19/2024
3.0.116 93 12/18/2024
3.0.115 141 12/18/2024
3.0.114 197 12/17/2024
3.0.113 109 12/17/2024
3.0.112 72 12/17/2024
3.0.111 209 12/16/2024
3.0.110 290 12/10/2024
3.0.109 95 12/10/2024
3.0.108 174 12/10/2024
3.0.107 93 12/9/2024
3.0.106 176 12/9/2024
3.0.105 215 12/9/2024
3.0.104 90 12/9/2024
3.0.103 292 12/7/2024
3.0.102 115 12/6/2024
3.0.101 113 12/6/2024
3.0.100 108 12/6/2024
3.0.99 111 12/6/2024
3.0.97 137 12/6/2024
3.0.96 117 12/6/2024
3.0.95 95 12/6/2024
3.0.94 97 12/6/2024
3.0.93 97 12/6/2024
3.0.92 98 12/6/2024
3.0.91 132 12/6/2024
3.0.90 124 12/5/2024
3.0.89 121 12/5/2024
3.0.88 675 12/5/2024
3.0.87 136 12/5/2024
3.0.86 141 12/5/2024
3.0.85 187 12/5/2024
3.0.84 120 12/4/2024
3.0.83 142 12/4/2024
3.0.82 200 12/4/2024
3.0.81 187 12/4/2024
3.0.80 169 12/4/2024
3.0.79 97 12/3/2024
3.0.78 192 12/3/2024
3.0.77 192 12/3/2024
3.0.76 154 12/3/2024
3.0.75 86 12/3/2024
3.0.74 139 12/3/2024
3.0.73 85 12/3/2024
3.0.72 357 12/2/2024
3.0.71 148 12/2/2024
3.0.70 167 12/2/2024
3.0.69 93 12/2/2024
3.0.68 168 12/2/2024
3.0.67 215 12/1/2024
3.0.66 96 12/1/2024
3.0.65 251 12/1/2024
3.0.64 129 12/1/2024
3.0.63 201 11/29/2024
3.0.62 171 11/29/2024
3.0.61 258 11/21/2024
3.0.60 109 11/21/2024
3.0.59 259 11/20/2024
3.0.58 101 11/20/2024
3.0.57 122 11/20/2024
3.0.56 100 11/20/2024
3.0.55 101 11/20/2024
3.0.54 112 11/20/2024
3.0.53 107 11/19/2024
3.0.52 98 11/19/2024
3.0.51 95 11/19/2024
3.0.50 383 11/19/2024
3.0.49 88 11/19/2024
3.0.48 308 11/19/2024
3.0.47 94 11/19/2024
3.0.46 98 11/19/2024
3.0.45 295 11/15/2024
3.0.44 141 11/14/2024
3.0.43 95 11/14/2024
3.0.42 94 11/14/2024
3.0.41 140 11/14/2024
3.0.40 108 11/14/2024
3.0.39 219 11/14/2024
3.0.38 316 11/14/2024
3.0.37 160 11/14/2024
3.0.36 96 11/14/2024
3.0.35 98 11/14/2024
3.0.34 143 11/14/2024
3.0.33 100 11/14/2024
3.0.32 194 11/14/2024
2.1.31 296 11/13/2024
2.1.30 183 11/13/2024
2.1.29 260 11/13/2024
2.1.28 146 11/12/2024
2.1.27 90 11/12/2024
2.1.26 652 11/9/2024
2.1.25 182 11/9/2024
2.1.24 343 11/8/2024
2.1.23 107 11/8/2024
2.1.22 98 11/8/2024
2.1.21 291 11/8/2024
2.1.20 236 11/8/2024
2.1.19 264 11/6/2024
2.1.18 335 11/1/2024
2.1.17 97 11/1/2024
2.1.16 325 11/1/2024
2.1.14 112 10/29/2024
2.1.13 260 10/29/2024
2.1.12 147 10/29/2024
2.1.11 416 10/29/2024
2.1.10 259 10/28/2024
2.1.9 97 10/28/2024
2.1.8 126 10/28/2024
2.1.7 358 10/26/2024
2.1.6 116 10/26/2024
2.1.5 262 10/22/2024
2.1.4 118 10/22/2024
2.1.3 94 10/22/2024
2.1.2 103 10/22/2024
2.1.1 123 10/22/2024