FullThrottle 1.8072.38563
See the version list below for details.
dotnet add package FullThrottle --version 1.8072.38563
NuGet\Install-Package FullThrottle -Version 1.8072.38563
<PackageReference Include="FullThrottle" Version="1.8072.38563" />
paket add FullThrottle --version 1.8072.38563
#r "nuget: FullThrottle, 1.8072.38563"
// Install FullThrottle as a Cake Addin #addin nuget:?package=FullThrottle&version=1.8072.38563 // Install FullThrottle as a Cake Tool #tool nuget:?package=FullThrottle&version=1.8072.38563
#Full trottle
This library uses throttling to overcome the problem of excessively lengthy queue processing. Use case: You have a 100000000 line text file to parse, and you must submit a http post request to an external api server for each line. The server owner requests that you not overwhelm the server by sending more than 10 requests per second.
Many publications describe how to submit requests as quickly as possible, however this library adds the term allowed. As a result, the goal of this library is to deliver requests at the fastest possible pace in order to avoid DDOSing the target site.
Usage example
Minimum example
var lines = new List<string> { "A", "B", "C" /* very long enumerations */ };
var runner = RunnerBuilder<string>
.Create((line, lineNumber) => Work(line, lineNumber))
.Build();
runner.Run(lines, CancellationToken.None);
Maximum example
var lines = new List<string> { "A", "B", "C" /* very long enumerations */ };
var runner = RunnerBuilder<string>
.Create((line, lineNumber) => Work(line, lineNumber))
.OnError((line, e, lineNumber) => { Console.WriteLine($"Error. Line:{line} Number:{lineNumber} Error:{e.Message}"); })
.OnSuccess((line, e, lineNumber) => { Console.WriteLine($"Success. Line:{line} Number:{lineNumber} Error:{e.Message}"); })
.WithMaximumRunningTasksLimit(20)
.WithMaximumTasksPerIntervalLimit(10, TimeSpan.FromSeconds(5))
.WithMinimumTaskRunInterval(TimeSpan.FromMilliseconds(250))
.WithDiagnosticInfo(LogIt)
.ForceNewThreadCreation()
.Build();
runner.Run(lines, CancellationToken.None);
// .WithDiagnosticInfo
private static void LogIt(string message, IEnumerable<TaskInfo> tasks)
{
var now = DateTime.Now;
var sb = new StringBuilder();
foreach (var element in Enum.GetNames(typeof(TaskStatus)))
{
TaskStatus s = (TaskStatus)Enum.Parse(typeof(TaskStatus), element);
sb.Append($"{element}: {tasks.Count(i => i.Task.Status == s)}, ");
}
if (tasks.TryGetNonEnumeratedCount(out int count))
{
Console.WriteLine($"{message} {count} {sb}");
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.8090.38039 | 505 | 2/24/2022 |
1.8072.38563 | 440 | 2/6/2022 |
1.8066.17594 | 457 | 1/31/2022 |
1.8062.21901 | 467 | 1/27/2022 |
1.8062.21109 | 444 | 1/27/2022 |
1.0.0 | 461 | 1/27/2022 |