Soenneker.Utils.RateLimiting.Executor 3.0.342

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

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

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.347 195 3/7/2025
3.0.346 219 3/7/2025
3.0.345 284 3/2/2025
3.0.344 126 3/2/2025
3.0.343 124 3/2/2025
3.0.342 78 3/2/2025
3.0.341 86 3/2/2025
3.0.340 197 3/2/2025
3.0.339 195 3/1/2025
3.0.338 74 3/1/2025
3.0.337 74 3/1/2025
3.0.336 401 3/1/2025
3.0.335 106 3/1/2025
3.0.334 64 3/1/2025
3.0.333 184 3/1/2025
3.0.332 72 3/1/2025
3.0.331 68 3/1/2025
3.0.330 296 2/25/2025
3.0.329 125 2/25/2025
3.0.328 166 2/25/2025
3.0.327 192 2/25/2025
3.0.326 143 2/25/2025
3.0.325 365 2/23/2025
3.0.324 139 2/23/2025
3.0.323 78 2/22/2025
3.0.322 342 2/22/2025
3.0.321 170 2/22/2025
3.0.320 121 2/22/2025
3.0.319 179 2/22/2025
3.0.318 81 2/21/2025
3.0.317 205 2/21/2025
3.0.316 255 2/21/2025
3.0.315 307 2/19/2025
3.0.314 117 2/19/2025
3.0.313 118 2/19/2025
3.0.312 89 2/18/2025
3.0.311 300 2/18/2025
3.0.310 156 2/18/2025
3.0.309 86 2/18/2025
3.0.308 438 2/14/2025
3.0.307 84 2/14/2025
3.0.306 163 2/13/2025
3.0.305 389 2/12/2025
3.0.304 106 2/12/2025
3.0.303 177 2/12/2025
3.0.302 179 2/11/2025
3.0.301 168 2/11/2025
3.0.300 295 2/11/2025
3.0.299 233 2/11/2025
3.0.298 85 2/11/2025
3.0.297 169 2/11/2025
3.0.296 186 2/10/2025
3.0.295 136 2/10/2025
3.0.294 183 2/10/2025
3.0.293 84 2/10/2025
3.0.292 88 2/10/2025
3.0.291 371 2/9/2025
3.0.290 99 2/8/2025
3.0.289 75 2/8/2025
3.0.288 79 2/8/2025
3.0.287 86 2/8/2025
3.0.286 304 2/8/2025
3.0.285 100 2/7/2025
3.0.284 132 2/7/2025
3.0.283 247 2/7/2025
3.0.282 84 2/7/2025
3.0.281 79 2/7/2025
3.0.280 78 2/7/2025
3.0.279 127 2/7/2025
3.0.278 76 2/7/2025
3.0.277 92 2/7/2025
3.0.276 368 2/6/2025
3.0.275 242 2/5/2025
3.0.274 155 2/5/2025
3.0.273 85 2/5/2025
3.0.272 97 2/5/2025
3.0.271 230 2/5/2025
3.0.270 91 2/5/2025
3.0.269 85 2/5/2025
3.0.268 494 1/28/2025
3.0.267 82 1/28/2025
3.0.266 94 1/28/2025
3.0.265 310 1/27/2025
3.0.264 90 1/27/2025
3.0.263 72 1/27/2025
3.0.262 68 1/27/2025
3.0.261 136 1/27/2025
3.0.260 94 1/27/2025
3.0.259 269 1/26/2025
3.0.258 95 1/26/2025
3.0.257 89 1/26/2025
3.0.256 71 1/26/2025
3.0.255 164 1/25/2025
3.0.254 198 1/25/2025
3.0.253 78 1/25/2025
3.0.252 73 1/25/2025
3.0.251 73 1/25/2025
3.0.250 189 1/25/2025
3.0.249 364 1/24/2025
3.0.248 116 1/24/2025
3.0.247 184 1/24/2025
3.0.246 143 1/24/2025
3.0.245 246 1/24/2025
3.0.244 179 1/23/2025
3.0.243 252 1/21/2025
3.0.242 85 1/21/2025
3.0.241 163 1/21/2025
3.0.240 90 1/21/2025
3.0.239 75 1/21/2025
3.0.238 272 1/21/2025
3.0.237 83 1/21/2025
3.0.236 78 1/21/2025
3.0.235 74 1/21/2025
3.0.234 79 1/21/2025
3.0.233 77 1/20/2025
3.0.232 93 1/20/2025
3.0.231 561 1/20/2025
3.0.230 87 1/20/2025
3.0.229 76 1/20/2025
3.0.228 231 1/20/2025
3.0.227 1,813 1/14/2025
3.0.226 57 1/14/2025
3.0.225 72 1/14/2025
3.0.224 130 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 122 1/11/2025
3.0.215 127 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 115 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 94 12/31/2024
3.0.186 95 12/31/2024
3.0.185 88 12/31/2024
3.0.184 147 12/31/2024
3.0.183 100 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 91 12/31/2024
3.0.176 90 12/31/2024
3.0.175 82 12/31/2024
3.0.174 111 12/30/2024
3.0.173 348 12/28/2024
3.0.172 107 12/28/2024
3.0.171 146 12/27/2024
3.0.170 89 12/27/2024
3.0.169 417 12/24/2024
3.0.168 186 12/24/2024
3.0.167 116 12/24/2024
3.0.166 95 12/24/2024
3.0.165 179 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 153 12/23/2024
3.0.158 167 12/23/2024
3.0.157 91 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 91 12/22/2024
3.0.145 100 12/22/2024
3.0.144 89 12/22/2024
3.0.143 254 12/21/2024
3.0.142 89 12/21/2024
3.0.141 100 12/21/2024
3.0.140 85 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 277 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 234 12/21/2024
3.0.129 86 12/21/2024
3.0.128 138 12/20/2024
3.0.127 81 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 162 12/19/2024
3.0.118 95 12/19/2024
3.0.117 142 12/19/2024
3.0.116 88 12/18/2024
3.0.115 136 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 204 12/16/2024
3.0.110 286 12/10/2024
3.0.109 88 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 210 12/9/2024
3.0.104 85 12/9/2024
3.0.103 287 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 132 12/6/2024
3.0.96 113 12/6/2024
3.0.95 90 12/6/2024
3.0.94 92 12/6/2024
3.0.93 93 12/6/2024
3.0.92 93 12/6/2024
3.0.91 128 12/6/2024
3.0.90 119 12/5/2024
3.0.89 116 12/5/2024
3.0.88 671 12/5/2024
3.0.87 132 12/5/2024
3.0.86 136 12/5/2024
3.0.85 181 12/5/2024
3.0.84 113 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 164 12/4/2024
3.0.79 93 12/3/2024
3.0.78 187 12/3/2024
3.0.77 188 12/3/2024
3.0.76 149 12/3/2024
3.0.75 81 12/3/2024
3.0.74 134 12/3/2024
3.0.73 80 12/3/2024
3.0.72 352 12/2/2024
3.0.71 142 12/2/2024
3.0.70 160 12/2/2024
3.0.69 87 12/2/2024
3.0.68 163 12/2/2024
3.0.67 207 12/1/2024
3.0.66 89 12/1/2024
3.0.65 245 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 103 11/21/2024
3.0.59 253 11/20/2024
3.0.58 95 11/20/2024
3.0.57 117 11/20/2024
3.0.56 94 11/20/2024
3.0.55 96 11/20/2024
3.0.54 106 11/20/2024
3.0.53 101 11/19/2024
3.0.52 93 11/19/2024
3.0.51 89 11/19/2024
3.0.50 378 11/19/2024
3.0.49 83 11/19/2024
3.0.48 302 11/19/2024
3.0.47 89 11/19/2024
3.0.46 92 11/19/2024
3.0.45 289 11/15/2024
3.0.44 135 11/14/2024
3.0.43 90 11/14/2024
3.0.42 87 11/14/2024
3.0.41 137 11/14/2024
3.0.40 105 11/14/2024
3.0.39 215 11/14/2024
3.0.38 312 11/14/2024
3.0.37 157 11/14/2024
3.0.36 92 11/14/2024
3.0.35 94 11/14/2024
3.0.34 139 11/14/2024
3.0.33 95 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 647 11/9/2024
2.1.25 179 11/9/2024
2.1.24 339 11/8/2024
2.1.23 103 11/8/2024
2.1.22 93 11/8/2024
2.1.21 288 11/8/2024
2.1.20 232 11/8/2024
2.1.19 259 11/6/2024
2.1.18 330 11/1/2024
2.1.17 91 11/1/2024
2.1.16 319 11/1/2024
2.1.14 107 10/29/2024
2.1.13 256 10/29/2024
2.1.12 144 10/29/2024
2.1.11 413 10/29/2024
2.1.10 255 10/28/2024
2.1.9 94 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 119 10/22/2024