Soenneker.Utils.RateLimiting.Executor 3.0.233

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

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

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.308 92 4 days ago
3.0.307 33 4 days ago
3.0.306 72 4 days ago
3.0.305 224 6 days ago
3.0.304 81 6 days ago
3.0.303 123 6 days ago
3.0.302 138 6 days ago
3.0.301 126 6 days ago
3.0.300 178 7 days ago
3.0.299 204 7 days ago
3.0.298 64 7 days ago
3.0.297 148 7 days ago
3.0.296 166 8 days ago
3.0.295 115 8 days ago
3.0.294 162 8 days ago
3.0.293 61 8 days ago
3.0.292 64 8 days ago
3.0.291 354 9 days ago
3.0.290 83 9 days ago
3.0.289 61 10 days ago
3.0.288 65 10 days ago
3.0.287 70 10 days ago
3.0.286 287 10 days ago
3.0.285 85 10 days ago
3.0.284 117 11 days ago
3.0.283 234 11 days ago
3.0.282 68 11 days ago
3.0.281 64 11 days ago
3.0.280 65 11 days ago
3.0.279 109 11 days ago
3.0.278 61 11 days ago
3.0.277 73 11 days ago
3.0.276 279 12 days ago
3.0.275 179 13 days ago
3.0.274 135 13 days ago
3.0.273 72 13 days ago
3.0.272 83 13 days ago
3.0.271 214 13 days ago
3.0.270 77 13 days ago
3.0.269 71 13 days ago
3.0.268 428 21 days ago
3.0.267 37 21 days ago
3.0.266 49 21 days ago
3.0.265 253 21 days ago
3.0.264 39 22 days ago
3.0.263 33 22 days ago
3.0.262 30 22 days ago
3.0.261 83 22 days ago
3.0.260 46 22 days ago
3.0.259 212 23 days ago
3.0.258 46 23 days ago
3.0.257 45 23 days ago
3.0.256 30 23 days ago
3.0.255 118 23 days ago
3.0.254 146 24 days ago
3.0.253 35 24 days ago
3.0.252 34 24 days ago
3.0.251 32 24 days ago
3.0.250 122 24 days ago
3.0.249 224 25 days ago
3.0.248 33 25 days ago
3.0.247 103 25 days ago
3.0.246 90 25 days ago
3.0.245 173 25 days ago
3.0.244 114 a month ago
3.0.243 238 a month ago
3.0.242 71 a month ago
3.0.241 144 a month ago
3.0.240 75 a month ago
3.0.239 64 a month ago
3.0.238 257 a month ago
3.0.237 69 a month ago
3.0.236 62 a month ago
3.0.235 61 a month ago
3.0.234 63 a month ago
3.0.233 64 a month ago
3.0.232 80 a month ago
3.0.231 548 a month ago
3.0.230 71 a month ago
3.0.229 62 a month ago
3.0.228 217 a month ago
3.0.227 1,781 a month ago
3.0.226 35 a month ago
3.0.225 42 a month ago
3.0.224 60 a month ago
3.0.223 141 a month ago
3.0.222 111 a month ago
3.0.221 90 a month ago
3.0.220 64 a month ago
3.0.219 55 a month ago
3.0.218 148 a month ago
3.0.217 115 a month ago
3.0.216 93 a month ago
3.0.215 105 a month ago
3.0.214 69 a month ago
3.0.213 99 a month ago
3.0.212 69 a month ago
3.0.211 66 a month ago
3.0.210 68 a month ago
3.0.209 159 a month ago
3.0.208 74 a month ago
3.0.207 73 a month ago
3.0.206 511 a month ago
3.0.205 99 a month ago
3.0.204 140 a month ago
3.0.203 95 2 months ago
3.0.202 173 2 months ago
3.0.201 75 2 months ago
3.0.200 72 2 months ago
3.0.199 157 2 months ago
3.0.198 71 2 months ago
3.0.197 75 2 months ago
3.0.196 387 2 months ago
3.0.195 164 2 months ago
3.0.194 96 2 months ago
3.0.193 112 2 months ago
3.0.192 199 2 months ago
3.0.191 89 2 months ago
3.0.190 94 2 months ago
3.0.189 100 2 months ago
3.0.188 90 2 months ago
3.0.187 91 2 months ago
3.0.186 92 2 months ago
3.0.185 85 2 months ago
3.0.184 144 2 months ago
3.0.183 97 2 months ago
3.0.182 382 2 months ago
3.0.181 80 2 months ago
3.0.180 242 2 months ago
3.0.179 143 2 months ago
3.0.178 85 2 months ago
3.0.177 87 2 months ago
3.0.176 86 2 months ago
3.0.175 78 2 months ago
3.0.174 107 2 months ago
3.0.173 344 2 months ago
3.0.172 104 2 months ago
3.0.171 143 2 months ago
3.0.170 86 2 months ago
3.0.169 414 2 months ago
3.0.168 183 2 months ago
3.0.167 113 2 months ago
3.0.166 92 2 months ago
3.0.165 176 2 months ago
3.0.164 81 2 months ago
3.0.163 173 2 months ago
3.0.162 75 2 months ago
3.0.161 118 2 months ago
3.0.160 93 2 months ago
3.0.159 150 2 months ago
3.0.158 164 2 months ago
3.0.157 88 2 months ago
3.0.156 261 2 months ago
3.0.155 107 2 months ago
3.0.154 246 2 months ago
3.0.153 87 2 months ago
3.0.152 84 2 months ago
3.0.151 197 2 months ago
3.0.150 91 2 months ago
3.0.149 86 2 months ago
3.0.148 81 2 months ago
3.0.147 265 2 months ago
3.0.146 88 2 months ago
3.0.145 96 2 months ago
3.0.144 86 2 months ago
3.0.143 251 2 months ago
3.0.142 86 2 months ago
3.0.141 97 2 months ago
3.0.140 82 2 months ago
3.0.139 87 2 months ago
3.0.138 80 2 months ago
3.0.137 83 2 months ago
3.0.136 88 2 months ago
3.0.135 273 2 months ago
3.0.134 169 2 months ago
3.0.133 83 2 months ago
3.0.132 86 2 months ago
3.0.131 76 2 months ago
3.0.130 231 2 months ago
3.0.129 85 2 months ago
3.0.128 135 2 months ago
3.0.127 78 2 months ago
3.0.126 160 2 months ago
3.0.125 83 2 months ago
3.0.124 184 2 months ago
3.0.123 159 2 months ago
3.0.122 89 2 months ago
3.0.121 161 2 months ago
3.0.120 185 2 months ago
3.0.119 159 2 months ago
3.0.118 93 2 months ago
3.0.117 139 2 months ago
3.0.116 86 2 months ago
3.0.115 134 2 months ago
3.0.114 191 2 months ago
3.0.113 103 2 months ago
3.0.112 66 2 months ago
3.0.111 202 2 months ago
3.0.110 284 2 months ago
3.0.109 85 2 months ago
3.0.108 168 2 months ago
3.0.107 87 2 months ago
3.0.106 170 2 months ago
3.0.105 202 2 months ago
3.0.104 83 2 months ago
3.0.103 285 2 months ago
3.0.102 109 2 months ago
3.0.101 100 2 months ago
3.0.100 102 2 months ago
3.0.99 105 2 months ago
3.0.97 132 2 months ago
3.0.96 113 2 months ago
3.0.95 90 2 months ago
3.0.94 90 2 months ago
3.0.93 93 2 months ago
3.0.92 93 2 months ago
3.0.91 128 2 months ago
3.0.90 119 2 months ago
3.0.89 116 2 months ago
3.0.88 671 2 months ago
3.0.87 130 2 months ago
3.0.86 136 2 months ago
3.0.85 181 2 months ago
3.0.84 113 2 months ago
3.0.83 138 2 months ago
3.0.82 196 2 months ago
3.0.81 182 2 months ago
3.0.80 164 2 months ago
3.0.79 93 2 months ago
3.0.78 187 2 months ago
3.0.77 188 2 months ago
3.0.76 149 2 months ago
3.0.75 81 2 months ago
3.0.74 134 3 months ago
3.0.73 80 3 months ago
3.0.72 352 3 months ago
3.0.71 142 3 months ago
3.0.70 160 3 months ago
3.0.69 87 3 months ago
3.0.68 163 3 months ago
3.0.67 207 3 months ago
3.0.66 89 3 months ago
3.0.65 245 3 months ago
3.0.64 124 3 months ago
3.0.63 196 3 months ago
3.0.62 166 3 months ago
3.0.61 253 3 months ago
3.0.60 103 3 months ago
3.0.59 253 3 months ago
3.0.58 95 3 months ago
3.0.57 117 3 months ago
3.0.56 94 3 months ago
3.0.55 94 3 months ago
3.0.54 106 3 months ago
3.0.53 101 3 months ago
3.0.52 93 3 months ago
3.0.51 89 3 months ago
3.0.50 378 3 months ago
3.0.49 83 3 months ago
3.0.48 302 3 months ago
3.0.47 88 3 months ago
3.0.46 92 3 months ago
3.0.45 289 3 months ago
3.0.44 135 3 months ago
3.0.43 90 3 months ago
3.0.42 87 3 months ago
3.0.41 135 3 months ago
3.0.40 101 3 months ago
3.0.39 213 3 months ago
3.0.38 310 3 months ago
3.0.37 155 3 months ago
3.0.36 90 3 months ago
3.0.35 92 3 months ago
3.0.34 137 3 months ago
3.0.33 93 3 months ago
3.0.32 190 3 months ago
2.1.31 292 3 months ago
2.1.30 179 3 months ago
2.1.29 255 3 months ago
2.1.28 142 3 months ago
2.1.27 85 3 months ago
2.1.26 645 3 months ago
2.1.25 177 3 months ago
2.1.24 338 3 months ago
2.1.23 99 3 months ago
2.1.22 92 3 months ago
2.1.21 287 3 months ago
2.1.20 231 3 months ago
2.1.19 258 3 months ago
2.1.18 328 4 months ago
2.1.17 90 4 months ago
2.1.16 317 4 months ago
2.1.14 107 4 months ago
2.1.13 256 4 months ago
2.1.12 142 4 months ago
2.1.11 413 4 months ago
2.1.10 255 4 months ago
2.1.9 94 4 months ago
2.1.8 124 4 months ago
2.1.7 355 4 months ago
2.1.6 114 4 months ago
2.1.5 259 4 months ago
2.1.4 115 4 months ago
2.1.3 92 4 months ago
2.1.2 101 4 months ago
2.1.1 119 4 months ago