Table of Contents

Class WorkerRecoveryOptions

Namespace
Virtufin.WorkManager.Configuration
Assembly
Virtufin.WorkManager.dll

Worker recovery tuning. Controls whether WorkManagerRecoveryHostedService runs on startup and how it elects a leader when multiple WorkManager instances start concurrently.

public sealed record WorkerRecoveryOptions : IEquatable<WorkerRecoveryOptions>
Inheritance
WorkerRecoveryOptions
Implements
Inherited Members

Fields

AcquireTimeoutSecondsEnvVar

Env var for how long to wait for the leader lease before giving up.

public const string AcquireTimeoutSecondsEnvVar = "WORKER_RECOVERY_ACQUIRE_TIMEOUT_SECONDS"

Field Value

string

DefaultAcquireTimeoutSeconds

Default acquire timeout (30s — matches the typical Dapr state store call latency).

public const int DefaultAcquireTimeoutSeconds = 30

Field Value

int

DefaultEnabled

Default: recovery is enabled.

public const bool DefaultEnabled = true

Field Value

bool

DefaultLeaseTtlSeconds

Default lease TTL (5 minutes — long enough for typical recovery, short enough to release on crash).

public const int DefaultLeaseTtlSeconds = 300

Field Value

int

EnabledEnvVar

Env var that gates whether recovery runs at all on startup.

public const string EnabledEnvVar = "WORKER_RECOVERY_ON_START"

Field Value

string

LeaseTtlSecondsEnvVar

Env var for the lease TTL in seconds when this instance wins the leader election.

public const string LeaseTtlSecondsEnvVar = "WORKER_RECOVERY_LEASE_TTL_SECONDS"

Field Value

string

Properties

AcquireTimeoutSeconds

How long this instance will wait to acquire the lease before skipping recovery.

public int AcquireTimeoutSeconds { get; init; }

Property Value

int

Enabled

Whether recovery runs on startup at all.

public bool Enabled { get; init; }

Property Value

bool

LeaseTtlSeconds

How long the leader lease is held before another instance may take over.

public int LeaseTtlSeconds { get; init; }

Property Value

int

Methods

FromEnvironment(Func<string, string?>)

Reads options from the supplied environment-variable provider. Falls back to defaults when keys are absent or malformed.

public static WorkerRecoveryOptions FromEnvironment(Func<string, string?> getEnvironment)

Parameters

getEnvironment Func<string, string>

Returns

WorkerRecoveryOptions