Table of Contents

Class InstanceHeartbeatOptions

Namespace
Virtufin.WebSocketManager.Configuration
Assembly
Virtufin.WebSocketManager.dll

Tuning for the instance heartbeat / discovery mechanism. The InstanceHeartbeatService publishes the local instance ID to the Dapr state store on an interval, and the connection reclaimer reads it to populate its knownInstances set so live pods don't have their connections reclaimed.

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

Fields

DefaultDiscoveryIntervalSeconds

Default discovery interval: 30 seconds.

public const int DefaultDiscoveryIntervalSeconds = 30

Field Value

int

DefaultHeartbeatIntervalSeconds

Default heartbeat interval: 10 seconds.

public const int DefaultHeartbeatIntervalSeconds = 10

Field Value

int

DefaultStaleThresholdSeconds

Default stale threshold: 60 seconds (an instance whose heartbeat is older than this is considered dead).

public const int DefaultStaleThresholdSeconds = 60

Field Value

int

DiscoveryIntervalSecondsEnvVar

public const string DiscoveryIntervalSecondsEnvVar = "INSTANCE_DISCOVERY_INTERVAL_SECONDS"

Field Value

string

HeartbeatDisabled

Heartbeat disabled (heartbeat publishing skipped; reclaimer falls back to TTL-based detection).

public const int HeartbeatDisabled = 0

Field Value

int

HeartbeatIntervalSecondsEnvVar

public const string HeartbeatIntervalSecondsEnvVar = "INSTANCE_HEARTBEAT_INTERVAL_SECONDS"

Field Value

string

StaleThresholdSecondsEnvVar

Env var for StaleThresholdSeconds.

public const string StaleThresholdSecondsEnvVar = "INSTANCE_STALE_THRESHOLD_SECONDS"

Field Value

string

Properties

DiscoveryIntervalSeconds

Discovery interval (seconds) — how often this instance polls the state store for other live instances.

public int DiscoveryIntervalSeconds { get; init; }

Property Value

int

HeartbeatIntervalSeconds

Heartbeat interval (seconds). Set to 0 to disable.

public int HeartbeatIntervalSeconds { get; init; }

Property Value

int

StaleThresholdSeconds

How old a peer instance's heartbeat can be before it is considered dead.

public int StaleThresholdSeconds { get; init; }

Property Value

int

Methods

FromEnvironment(Func<string, string?>)

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

Parameters

getEnvironment Func<string, string>

Returns

InstanceHeartbeatOptions