HostLoom.Scheduling 0.11.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HostLoom.Scheduling --version 0.11.0
                    
NuGet\Install-Package HostLoom.Scheduling -Version 0.11.0
                    
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="HostLoom.Scheduling" Version="0.11.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HostLoom.Scheduling" Version="0.11.0" />
                    
Directory.Packages.props
<PackageReference Include="HostLoom.Scheduling" />
                    
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 HostLoom.Scheduling --version 0.11.0
                    
#r "nuget: HostLoom.Scheduling, 0.11.0"
                    
#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 HostLoom.Scheduling@0.11.0
                    
#: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=HostLoom.Scheduling&version=0.11.0
                    
Install as a Cake Addin
#tool nuget:?package=HostLoom.Scheduling&version=0.11.0
                    
Install as a Cake Tool

HostLoom.Scheduling

HostLoom.Scheduling is the backend-neutral scheduled-job kernel: the job contract IScheduledJob, the triggers that decide when a schedule runs, the Scheduler that waits on a TimeProvider and runs each schedule sequentially, and the IScheduleGuard contract that decides which instance runs a schedule marked exclusive. The package references only Microsoft.Extensions.Logging.Abstractions; every runtime type has a public constructor, so a scheduler composes without a container.

A schedule is a loop, not a queue. Each schedule runs one job at a time in this process: a run never starts while the previous run of the same schedule is still executing, and a run that is already late starts at once without replaying the occurrences it missed. Across processes, an Exclusive schedule claims itself through the guard before every run and is skipped, never queued, when another instance holds the claim.

var nightly = new ScheduleDefinition(
    "catalog:rebuild",
    ScheduleTrigger.Cron("0 0 2 * * *"),               // 02:00 UTC every day
    async (run, token) => await RebuildCatalogAsync(token),
    new ScheduleOptions { Exclusive = true, Timeout = TimeSpan.FromMinutes(30) });

var sync = new ScheduleDefinition(
    "inventory:sync",
    ScheduleTrigger.FixedDelay(TimeSpan.FromSeconds(30)), // 30 s after each completion
    async (run, token) => await SyncInventoryAsync(run.DueAt, token));

await using var scheduler = new Scheduler(new SchedulingOptions(), [nightly, sync], guard);
await scheduler.StartAsync();

A schedule without Exclusive runs on every instance that hosts it. An Exclusive schedule runs on one instance per occurrence: the claim is kept past the run until the lease ends or this instance's next occurrence is due, whichever comes first, so a slower instance reaching the same occurrence is refused rather than running the job again. Choose the lease as at least the clock skew between instances plus the run's duration, and no more than the period.

Three trigger shapes follow the Spring conventions. Cron takes five fields (minute, hour, day of month, month, day of week) or six with a leading seconds field, with *, lists, ranges, steps, month and day names, and ?; when both day fields are restricted an occurrence matches either, as in Vixie cron, and occurrences are evaluated in the zone given to the trigger, UTC by default. FixedRate counts each period from the previous due time, so a slow run does not drift the schedule. FixedDelay counts from the previous completion, so two runs are always separated by at least the delay.

A run receives a ScheduledRun (name, due time, start time, sequence) and a token that is cancelled when the host stops, when ScheduleOptions.Timeout elapses, or when an exclusive claim is lost. An exception ends the run as Failed; the schedule continues. Outcomes are recorded per schedule (Scheduler.GetState), on the hostloom.schedule.run.duration histogram by outcome, and in the log events listed in SchedulingEvents. A guard that throws skips the run as GuardFailed: a job that must not run twice cannot run when nothing can say whether another instance already does.

SchedulingOptions.Enabled = false runs nothing and says so at startup, for a deployment that keeps its registrations but must not execute jobs. SchedulingProbe.Describe(scheduler) reports the composition and the current state of every schedule without running anything. Install HostLoom.Scheduling.DependencyInjection to register the scheduler with the built-in .NET container and HostLoom.Scheduling.Locking to guard exclusive schedules with the HostLoom distributed lock.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on HostLoom.Scheduling:

Package Downloads
HostLoom.Scheduling.DependencyInjection

Microsoft.Extensions.DependencyInjection registration, per-run scopes, options validation, and hosting for HostLoom scheduling.

HostLoom.Scheduling.Leadership

Runs exclusive HostLoom schedules on the elected leader only, without a lock round trip per occurrence.

HostLoom.Scheduling.Testing

Scripted schedule guard and claim recording for testing HostLoom scheduling consumers without a backend.

HostLoom.Scheduling.Locking

Runs exclusive HostLoom schedules on one instance at a time by claiming them through the HostLoom distributed lock.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.17.0 0 10/25/2026
0.16.1 72 10/22/2026
0.16.0 111 10/14/2026
0.15.1 112 10/12/2026
0.15.0 133 10/4/2026
0.14.0 128 10/4/2026
0.13.0 125 9/28/2026
0.12.0 130 9/27/2026
0.11.0 130 9/25/2026
0.10.0 135 9/22/2026
0.9.0 130 9/22/2026