Skip to content
Tracon

SingletonExecutionOptions

Namespace Tracon · Assembly Tracon.Abstractions.dll

The settings of single-executor election.

public sealed class SingletonExecutionOptions

objectSingletonExecutionOptions

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

They are read from the Tracon:SingletonExecution configuration section. See TraconServiceCollectionExtensions.AddTracon.

public SingletonExecutionOptions()

The name of the configuration section.

public const string SectionName = "Tracon:SingletonExecution"

string

Gets or sets a value that turns on single-executor election. The default is false: behaviour does not change in a single-instance setup, and no query reaches the lease table.

public bool Enabled { get; set; }

bool

Gets or sets the lease duration. Renewal happens at ONE THIRD of this duration; at half of it, a single missed renewal would drop the lease.

public TimeSpan LeaseDuration { get; set; }

TimeSpan

While SingletonExecutionOptions.Enabled is true this must be at least THREE SECONDS, and startup fails otherwise. Renewal never runs faster than once a second, so below that the renewal would land on or after the expiry: the lease would look expired while its owner is alive, and a second instance would take over work that has to run on one.

Gets or sets the id of this instance. When it is null or empty it is generated automatically (machine name plus process id plus a unique suffix).

public string? OwnerId { get; set; }

string?