feat(gateway,worker): configurable worker watchdog grace; heartbeat settings in effective config and Settings page (mxaccessgw#224)
- New MxGateway:Worker:WorkerHeartbeatGraceSeconds (default 15), exported as MXGATEWAY_WORKER_HEARTBEAT_GRACE_MS and read by WorkerPipeSessionOptions.FromEnvironment (a grace the ceiling does not exceed falls back to the default so the worker still starts). Validation now checks WorkerHeartbeatStuckCeilingSeconds against the configured grace; the copied WorkerWatchdogGraceSeconds constant is gone. - EffectiveWorkerConfiguration and the dashboard Settings page now show the worker heartbeat send interval, watchdog grace and stuck ceiling (render test added). - Docs updated. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -26,6 +26,31 @@ public sealed class WorkerPipeSessionOptionsTests
|
||||
options.Validate();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a launcher-provided grace replaces the compiled default (mxaccessgw#224).</summary>
|
||||
[Fact]
|
||||
public void FromEnvironment_WithGrace_UsesItAndStaysValid()
|
||||
{
|
||||
WorkerPipeSessionOptions options = WorkerPipeSessionOptions.FromEnvironment(Lookup(
|
||||
(WorkerLaunchEnvironment.HeartbeatGraceMilliseconds, "30000"),
|
||||
(WorkerLaunchEnvironment.HeartbeatStuckCeilingMilliseconds, "120000")));
|
||||
|
||||
Assert.Equal(TimeSpan.FromSeconds(30), options.HeartbeatGrace);
|
||||
Assert.Equal(TimeSpan.FromSeconds(120), options.HeartbeatStuckCeiling);
|
||||
options.Validate();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a grace the ceiling does not exceed is dropped rather than failing the worker.</summary>
|
||||
[Fact]
|
||||
public void FromEnvironment_WithGraceAtOrAboveCeiling_FallsBackToDefaultGrace()
|
||||
{
|
||||
WorkerPipeSessionOptions options = WorkerPipeSessionOptions.FromEnvironment(Lookup(
|
||||
(WorkerLaunchEnvironment.HeartbeatGraceMilliseconds, "80000")));
|
||||
|
||||
Assert.Equal(WorkerPipeSessionOptions.DefaultHeartbeatGrace, options.HeartbeatGrace);
|
||||
Assert.Equal(WorkerPipeSessionOptions.DefaultHeartbeatStuckCeiling, options.HeartbeatStuckCeiling);
|
||||
options.Validate();
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an absent environment yields the compiled defaults.</summary>
|
||||
[Fact]
|
||||
public void FromEnvironment_WithNothingSet_KeepsDefaults()
|
||||
|
||||
Reference in New Issue
Block a user