Soenneker.Utils.Delay 11.0.110

Prefix Reserved
dotnet add package Soenneker.Utils.Delay --version 11.0.110
                    
NuGet\Install-Package Soenneker.Utils.Delay -Version 11.0.110
                    
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.Delay" Version="11.0.110" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.Delay" Version="11.0.110" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.Delay" />
                    
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.Delay --version 11.0.110
                    
#r "nuget: Soenneker.Utils.Delay, 11.0.110"
                    
#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.
#:package Soenneker.Utils.Delay@11.0.110
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Utils.Delay&version=11.0.110
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.Delay&version=11.0.110
                    
Install 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.Delay

Static delay helpers for cancellable waits, positive jitter, exponential backoff, random ranges, and UTC deadlines.

Installation

dotnet add package Soenneker.Utils.Delay

Basic delays

await DelayUtil.Delay(250, cancellationToken: cancellationToken);
await DelayUtil.Delay(TimeSpan.FromSeconds(2), cancellationToken: cancellationToken);
await DelayUtil.DelaySeconds(1.5, cancellationToken: cancellationToken);
await DelayUtil.DelayUntil(deadlineUtc, cancellationToken: cancellationToken);

Non-positive durations and deadlines that have passed complete immediately. They still produce a cancelled ValueTask when the supplied token is already cancelled.

DelaySync() uses Thread.Sleep and blocks the calling thread. Reserve it for code that cannot be asynchronous; do not use it on request, UI, or other throughput-sensitive threads.

Jitter and backoff

await DelayUtil.DelayWithJitter(
    baseMilliseconds: 1_000,
    jitterFactor: 0.25,
    cancellationToken: cancellationToken);

await DelayUtil.DelayWithBackoff(
    attempt: attempt,
    baseDelayMs: 500,
    maxDelayMs: 30_000,
    cancellationToken: cancellationToken);

Jitter is positive-only: a factor of 0.25 produces a wait from the base delay up to, but generally below, 125% of it. Factors above 1 are capped at 1; non-positive or NaN factors use the base delay without jitter.

Backoff uses baseDelayMs * 2^attempt, capped by maxDelayMs. Attempts at or below zero use the base delay, attempts at 30 or above use the maximum, and non-positive base or maximum values are normalized to one millisecond.

Random range

await DelayUtil.DelayRandomRange(
    minMilliseconds: 200,
    maxMilliseconds: 500,
    cancellationToken: cancellationToken);

Both endpoints are inclusive. A negative minimum is normalized to zero. If the maximum is not greater than the normalized minimum, the minimum is used.

Every helper accepts an optional ILogger; when supplied, the selected delay is logged before waiting.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on Soenneker.Utils.Delay:

Package Downloads
Soenneker.Blazor.Utils.Session

A Blazor utility for access-token caching and optional idle-timeout navigation

Soenneker.GitHub.Repositories.PullRequests

Retrieves, reviews, rebases, and merges GitHub pull requests across repositories

Soenneker.Blob.Copy

A utility library for Azure Blob storage copy operations

Soenneker.GitHub.Artifacts

Lists and deletes GitHub Actions artifacts across repositories.

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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.110 2,411 11/11/2026
11.0.109 74 11/11/2026
11.0.108 6,509 11/3/2026
11.0.107 6,631 10/26/2026
11.0.106 357 10/26/2026
4.0.105 960 10/26/2026
4.0.104 4,923 10/15/2026
4.0.103 1,635 10/14/2026
4.0.101 174 10/14/2026
4.0.96 851 10/13/2026
4.0.95 379 10/13/2026
4.0.94 126 10/12/2026
4.0.93 2,673 10/11/2026
4.0.92 993 10/11/2026
4.0.91 14,960 9/24/2026
4.0.90 187 9/24/2026
4.0.89 6,841 9/15/2026
4.0.88 811 9/15/2026
4.0.87 3,873 9/13/2026
4.0.86 2,174 9/12/2026
Loading failed

Update dependency Soenneker.Utils.Random to 11.0.150 (#150)