Soenneker.Utils.RateLimiting.Executor 3.0.371

Prefix Reserved
dotnet add package Soenneker.Utils.RateLimiting.Executor --version 3.0.371
                    
NuGet\Install-Package Soenneker.Utils.RateLimiting.Executor -Version 3.0.371
                    
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.371" />
                    
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.371" />
                    
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.371
                    
#r "nuget: Soenneker.Utils.RateLimiting.Executor, 3.0.371"
                    
#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.371
                    
Install Soenneker.Utils.RateLimiting.Executor as a Cake Addin
#tool nuget:?package=Soenneker.Utils.RateLimiting.Executor&version=3.0.371
                    
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. 
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.371 0 4/1/2025
3.0.370 0 3/31/2025
3.0.369 12 3/31/2025
3.0.368 30 3/31/2025
3.0.367 62 3/31/2025
3.0.366 85 3/29/2025
3.0.365 45 3/29/2025
3.0.364 60 3/29/2025
3.0.363 553 3/25/2025
3.0.362 473 3/25/2025
3.0.361 290 3/21/2025
3.0.360 146 3/21/2025
3.0.359 405 3/18/2025
3.0.358 221 3/18/2025
3.0.357 201 3/15/2025
3.0.356 54 3/15/2025
3.0.355 397 3/12/2025
3.0.354 173 3/12/2025
3.0.353 228 3/12/2025
3.0.352 158 3/11/2025
3.0.351 302 3/11/2025
3.0.350 221 3/11/2025
3.0.349 144 3/11/2025
3.0.348 402 3/11/2025
3.0.347 360 3/7/2025
3.0.346 327 3/7/2025
3.0.345 320 3/2/2025
3.0.344 131 3/2/2025
3.0.343 129 3/2/2025
3.0.342 82 3/2/2025
3.0.341 90 3/2/2025
3.0.340 201 3/2/2025
3.0.339 199 3/1/2025
3.0.338 78 3/1/2025
3.0.337 79 3/1/2025
3.0.336 405 3/1/2025
3.0.335 111 3/1/2025
3.0.334 69 3/1/2025
3.0.333 189 3/1/2025
3.0.332 77 3/1/2025
3.0.331 73 3/1/2025
3.0.330 298 2/25/2025
3.0.329 127 2/25/2025
3.0.328 169 2/25/2025
3.0.327 194 2/25/2025
3.0.326 146 2/25/2025
3.0.325 368 2/23/2025
3.0.324 141 2/23/2025
3.0.323 81 2/22/2025
3.0.322 345 2/22/2025
3.0.321 173 2/22/2025
3.0.320 123 2/22/2025
3.0.319 184 2/22/2025
3.0.318 84 2/21/2025
3.0.317 207 2/21/2025
3.0.316 258 2/21/2025
3.0.315 309 2/19/2025
3.0.314 119 2/19/2025
3.0.313 120 2/19/2025
3.0.312 97 2/18/2025
3.0.311 302 2/18/2025
3.0.310 158 2/18/2025
3.0.309 89 2/18/2025
3.0.308 440 2/14/2025
3.0.307 86 2/14/2025
3.0.306 165 2/13/2025
3.0.305 391 2/12/2025
3.0.304 108 2/12/2025
3.0.303 179 2/12/2025
3.0.302 181 2/11/2025
3.0.301 170 2/11/2025
3.0.300 298 2/11/2025
3.0.299 235 2/11/2025
3.0.298 87 2/11/2025
3.0.297 172 2/11/2025
3.0.296 189 2/10/2025
3.0.295 138 2/10/2025
3.0.294 185 2/10/2025
3.0.293 87 2/10/2025
3.0.292 91 2/10/2025
3.0.291 374 2/9/2025
3.0.290 101 2/8/2025
3.0.289 77 2/8/2025
3.0.288 81 2/8/2025
3.0.287 89 2/8/2025
3.0.286 307 2/8/2025
3.0.285 102 2/7/2025
3.0.284 134 2/7/2025
3.0.283 250 2/7/2025
3.0.282 86 2/7/2025
3.0.281 81 2/7/2025
3.0.280 80 2/7/2025
3.0.279 130 2/7/2025
3.0.278 78 2/7/2025
3.0.277 94 2/7/2025
3.0.276 372 2/6/2025
3.0.275 245 2/5/2025
3.0.274 157 2/5/2025
3.0.273 88 2/5/2025
3.0.272 99 2/5/2025
3.0.271 233 2/5/2025
3.0.270 93 2/5/2025
3.0.269 88 2/5/2025
3.0.268 497 1/28/2025
3.0.267 84 1/28/2025
3.0.266 96 1/28/2025
3.0.265 312 1/27/2025
3.0.264 92 1/27/2025
3.0.263 74 1/27/2025
3.0.262 70 1/27/2025
3.0.261 139 1/27/2025
3.0.260 96 1/27/2025
3.0.259 271 1/26/2025
3.0.258 97 1/26/2025
3.0.257 91 1/26/2025
3.0.256 74 1/26/2025
3.0.255 166 1/25/2025
3.0.254 200 1/25/2025
3.0.253 79 1/25/2025
3.0.252 75 1/25/2025
3.0.251 74 1/25/2025
3.0.250 192 1/25/2025
3.0.249 367 1/24/2025
3.0.248 118 1/24/2025
3.0.247 185 1/24/2025
3.0.246 144 1/24/2025
3.0.245 247 1/24/2025
3.0.244 180 1/23/2025
3.0.243 253 1/21/2025
3.0.242 86 1/21/2025
3.0.241 164 1/21/2025
3.0.240 91 1/21/2025
3.0.239 78 1/21/2025
3.0.238 273 1/21/2025
3.0.237 84 1/21/2025
3.0.236 79 1/21/2025
3.0.235 75 1/21/2025
3.0.234 80 1/21/2025
3.0.233 78 1/20/2025
3.0.232 94 1/20/2025
3.0.231 562 1/20/2025
3.0.230 88 1/20/2025
3.0.229 77 1/20/2025
3.0.228 232 1/20/2025
3.0.227 1,816 1/14/2025
3.0.226 58 1/14/2025
3.0.225 73 1/14/2025
3.0.224 131 1/14/2025
3.0.223 181 1/13/2025
3.0.222 168 1/13/2025
3.0.221 117 1/13/2025
3.0.220 71 1/13/2025
3.0.219 62 1/13/2025
3.0.218 207 1/12/2025
3.0.217 152 1/11/2025
3.0.216 123 1/11/2025
3.0.215 128 1/11/2025
3.0.214 81 1/11/2025
3.0.213 125 1/10/2025
3.0.212 82 1/10/2025
3.0.211 74 1/10/2025
3.0.210 76 1/10/2025
3.0.209 224 1/10/2025
3.0.208 86 1/10/2025
3.0.207 84 1/10/2025
3.0.206 629 1/3/2025
3.0.205 112 1/3/2025
3.0.204 159 1/3/2025
3.0.203 108 1/3/2025
3.0.202 186 1/2/2025
3.0.201 88 1/2/2025
3.0.200 85 1/2/2025
3.0.199 170 1/2/2025
3.0.198 84 1/2/2025
3.0.197 88 1/2/2025
3.0.196 390 1/1/2025
3.0.195 167 1/1/2025
3.0.194 99 1/1/2025
3.0.193 117 1/1/2025
3.0.192 202 1/1/2025
3.0.191 92 1/1/2025
3.0.190 97 1/1/2025
3.0.189 103 12/31/2024
3.0.188 91 12/31/2024
3.0.187 95 12/31/2024
3.0.186 96 12/31/2024
3.0.185 88 12/31/2024
3.0.184 148 12/31/2024
3.0.183 101 12/31/2024
3.0.182 386 12/31/2024
3.0.181 85 12/31/2024
3.0.180 246 12/31/2024
3.0.179 145 12/31/2024
3.0.178 89 12/31/2024
3.0.177 92 12/31/2024
3.0.176 91 12/31/2024
3.0.175 83 12/31/2024
3.0.174 112 12/30/2024
3.0.173 348 12/28/2024
3.0.172 107 12/28/2024
3.0.171 147 12/27/2024
3.0.170 90 12/27/2024
3.0.169 417 12/24/2024
3.0.168 186 12/24/2024
3.0.167 117 12/24/2024
3.0.166 95 12/24/2024
3.0.165 180 12/24/2024
3.0.164 84 12/24/2024
3.0.163 174 12/24/2024
3.0.162 78 12/24/2024
3.0.161 121 12/24/2024
3.0.160 96 12/23/2024
3.0.159 154 12/23/2024
3.0.158 167 12/23/2024
3.0.157 92 12/23/2024
3.0.156 263 12/23/2024
3.0.155 108 12/23/2024
3.0.154 249 12/22/2024
3.0.153 90 12/22/2024
3.0.152 87 12/22/2024
3.0.151 200 12/22/2024
3.0.150 94 12/22/2024
3.0.149 89 12/22/2024
3.0.148 84 12/22/2024
3.0.147 268 12/22/2024
3.0.146 92 12/22/2024
3.0.145 101 12/22/2024
3.0.144 90 12/22/2024
3.0.143 254 12/21/2024
3.0.142 89 12/21/2024
3.0.141 101 12/21/2024
3.0.140 86 12/21/2024
3.0.139 90 12/21/2024
3.0.138 83 12/21/2024
3.0.137 86 12/21/2024
3.0.136 91 12/21/2024
3.0.135 278 12/21/2024
3.0.134 173 12/21/2024
3.0.133 86 12/21/2024
3.0.132 89 12/21/2024
3.0.131 79 12/21/2024
3.0.130 235 12/21/2024
3.0.129 87 12/21/2024
3.0.128 139 12/20/2024
3.0.127 82 12/20/2024
3.0.126 163 12/20/2024
3.0.125 86 12/20/2024
3.0.124 186 12/20/2024
3.0.123 164 12/20/2024
3.0.122 90 12/20/2024
3.0.121 163 12/20/2024
3.0.120 187 12/19/2024
3.0.119 163 12/19/2024
3.0.118 96 12/19/2024
3.0.117 142 12/19/2024
3.0.116 88 12/18/2024
3.0.115 137 12/18/2024
3.0.114 193 12/17/2024
3.0.113 105 12/17/2024
3.0.112 68 12/17/2024
3.0.111 205 12/16/2024
3.0.110 286 12/10/2024
3.0.109 89 12/10/2024
3.0.108 170 12/10/2024
3.0.107 89 12/9/2024
3.0.106 172 12/9/2024
3.0.105 211 12/9/2024
3.0.104 85 12/9/2024
3.0.103 288 12/7/2024
3.0.102 111 12/6/2024
3.0.101 108 12/6/2024
3.0.100 104 12/6/2024
3.0.99 107 12/6/2024
3.0.97 133 12/6/2024
3.0.96 113 12/6/2024
3.0.95 91 12/6/2024
3.0.94 93 12/6/2024
3.0.93 93 12/6/2024
3.0.92 94 12/6/2024
3.0.91 128 12/6/2024
3.0.90 120 12/5/2024
3.0.89 117 12/5/2024
3.0.88 671 12/5/2024
3.0.87 132 12/5/2024
3.0.86 137 12/5/2024
3.0.85 182 12/5/2024
3.0.84 116 12/4/2024
3.0.83 138 12/4/2024
3.0.82 196 12/4/2024
3.0.81 182 12/4/2024
3.0.80 165 12/4/2024
3.0.79 93 12/3/2024
3.0.78 188 12/3/2024
3.0.77 188 12/3/2024
3.0.76 150 12/3/2024
3.0.75 82 12/3/2024
3.0.74 135 12/3/2024
3.0.73 81 12/3/2024
3.0.72 353 12/2/2024
3.0.71 143 12/2/2024
3.0.70 161 12/2/2024
3.0.69 88 12/2/2024
3.0.68 163 12/2/2024
3.0.67 208 12/1/2024
3.0.66 90 12/1/2024
3.0.65 246 12/1/2024
3.0.64 124 12/1/2024
3.0.63 196 11/29/2024
3.0.62 166 11/29/2024
3.0.61 253 11/21/2024
3.0.60 104 11/21/2024
3.0.59 254 11/20/2024
3.0.58 96 11/20/2024
3.0.57 117 11/20/2024
3.0.56 96 11/20/2024
3.0.55 98 11/20/2024
3.0.54 107 11/20/2024
3.0.53 102 11/19/2024
3.0.52 94 11/19/2024
3.0.51 91 11/19/2024
3.0.50 381 11/19/2024
3.0.49 86 11/19/2024
3.0.48 305 11/19/2024
3.0.47 92 11/19/2024
3.0.46 95 11/19/2024
3.0.45 292 11/15/2024
3.0.44 138 11/14/2024
3.0.43 92 11/14/2024
3.0.42 90 11/14/2024
3.0.41 137 11/14/2024
3.0.40 105 11/14/2024
3.0.39 216 11/14/2024
3.0.38 313 11/14/2024
3.0.37 157 11/14/2024
3.0.36 93 11/14/2024
3.0.35 95 11/14/2024
3.0.34 140 11/14/2024
3.0.33 96 11/14/2024
3.0.32 191 11/14/2024
2.1.31 293 11/13/2024
2.1.30 180 11/13/2024
2.1.29 256 11/13/2024
2.1.28 143 11/12/2024
2.1.27 87 11/12/2024
2.1.26 648 11/9/2024
2.1.25 179 11/9/2024
2.1.24 340 11/8/2024
2.1.23 103 11/8/2024
2.1.22 94 11/8/2024
2.1.21 288 11/8/2024
2.1.20 233 11/8/2024
2.1.19 261 11/6/2024
2.1.18 332 11/1/2024
2.1.17 94 11/1/2024
2.1.16 322 11/1/2024
2.1.14 109 10/29/2024
2.1.13 258 10/29/2024
2.1.12 145 10/29/2024
2.1.11 414 10/29/2024
2.1.10 256 10/28/2024
2.1.9 95 10/28/2024
2.1.8 124 10/28/2024
2.1.7 355 10/26/2024
2.1.6 114 10/26/2024
2.1.5 260 10/22/2024
2.1.4 116 10/22/2024
2.1.3 92 10/22/2024
2.1.2 101 10/22/2024
2.1.1 121 10/22/2024