dc9c0c950c
Apply the ZB.MOM.WW. prefix to all gateway-side projects, folders,
.csproj/.sln contents, C# namespaces, using directives, generated proto
C# (csharp_namespace + checked-in generated files), InternalsVisibleTo
attributes, project-name string literals (LoadProject, .sln lookups,
worker exe paths, staticwebassets manifest), and the install/script/doc
references that point at any of the above. Migrate the solution from
.sln to .slnx via `dotnet sln migrate` and delete the old file.
External-runtime identifiers are intentionally NOT prefixed so external
configuration keeps working:
- GatewayMetrics.cs MeterName ("MxGateway.Server")
- DashboardAuthenticationDefaults Scheme/Policy ("MxGateway.Dashboard")
- GatewayRequestLoggingMiddleware logger category ("MxGateway.Request")
- StaRuntime thread name ("MxGateway.Worker.STA")
- appsettings.json root section "MxGateway" + env-var prefix
MxGateway__... and secret-name MxGateway:ApiKeyPepper
- C:\ProgramData\MxGateway\ data dir paths
Also fixes two tests that were not rename-related but became visible
while validating the rename:
- WorkerLiveMxAccessSmokeTests.ShutDownAsync: cancellation that the
gateway service correctly maps to RpcException(Cancelled) per gRPC
convention was being misclassified as a stream fault. Added a sibling
catch on RpcException with StatusCode.Cancelled.
- IntegrationTestEnvironment.ResolveRepositoryRoot: extracted IsRepositoryRoot
and made it accept either a .git marker OR a .sln/.slnx next to src/
so the worker-exe walker works in non-git working copies.
clients/proto/proto-inputs.json's protoRoot updated to point at
src/ZB.MOM.WW.MxGateway.Contracts/Protos.
Verified by `dotnet build` and a full `dotnet test` of the .slnx with
MXGATEWAY_RUN_LIVE_{MXACCESS,LDAP,GALAXY}_TESTS=1:
Tests: 472/472 pass
Worker.Tests: 280/280 pass (4 dev-rig [Fact(Skip=...)] skipped)
IntegrationTests: 18/18 pass
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
69 lines
3.3 KiB
C#
69 lines
3.3 KiB
C#
namespace ZB.MOM.WW.MxGateway.Server.Workers;
|
|
|
|
/// <summary>Configurable options for worker client behavior.</summary>
|
|
public sealed class WorkerClientOptions
|
|
{
|
|
/// <summary>Default maximum age of a heartbeat before the client enters faulted state.</summary>
|
|
public static readonly TimeSpan DefaultHeartbeatGrace = TimeSpan.FromSeconds(15);
|
|
|
|
/// <summary>Default interval for checking heartbeat staleness.</summary>
|
|
public static readonly TimeSpan DefaultHeartbeatCheckInterval = TimeSpan.FromSeconds(1);
|
|
|
|
/// <summary>Default timeout when the event queue is full.</summary>
|
|
public static readonly TimeSpan DefaultEventChannelFullModeTimeout = TimeSpan.FromSeconds(5);
|
|
|
|
/// <summary>
|
|
/// Default ceiling on the in-flight-command heartbeat skip. Mirrors
|
|
/// <see cref="ZB.MOM.WW.MxGateway.Worker.Ipc.WorkerPipeSessionOptions.DefaultHeartbeatStuckCeiling"/>
|
|
/// on the worker side (Worker-023). When a command has been in flight
|
|
/// longer than this, the gateway-side heartbeat watchdog fires
|
|
/// regardless of pending commands — a truly stuck COM call shouldn't
|
|
/// hide the worker forever.
|
|
/// </summary>
|
|
public static readonly TimeSpan DefaultHeartbeatStuckCeiling = TimeSpan.FromSeconds(75);
|
|
|
|
/// <summary>Initializes options with default values.</summary>
|
|
public WorkerClientOptions()
|
|
{
|
|
HeartbeatGrace = DefaultHeartbeatGrace;
|
|
HeartbeatCheckInterval = DefaultHeartbeatCheckInterval;
|
|
EventChannelCapacity = 1_024;
|
|
EventChannelFullModeTimeout = DefaultEventChannelFullModeTimeout;
|
|
MaxPendingCommands = 128;
|
|
HeartbeatStuckCeiling = DefaultHeartbeatStuckCeiling;
|
|
}
|
|
|
|
/// <summary>Maximum allowed age of the last heartbeat before faulting the client.</summary>
|
|
public TimeSpan HeartbeatGrace { get; init; }
|
|
|
|
/// <summary>Interval at which to check for heartbeat expiration.</summary>
|
|
public TimeSpan HeartbeatCheckInterval { get; init; }
|
|
|
|
/// <summary>Maximum number of events buffered before backpressure is applied.</summary>
|
|
public int EventChannelCapacity { get; init; }
|
|
|
|
/// <summary>
|
|
/// Time to wait for the gateway-side event channel to drain before
|
|
/// faulting the worker. Honored by <c>EnqueueWorkerEventAsync</c> via
|
|
/// <c>WriteAsync</c>; with the channel configured for
|
|
/// <c>BoundedChannelFullMode.Wait</c>, a transient backlog only faults
|
|
/// after the configured timeout has elapsed (Server-032). Pre-Server-032
|
|
/// the field was declared but unused — overflow faulted immediately.
|
|
/// </summary>
|
|
public TimeSpan EventChannelFullModeTimeout { get; init; }
|
|
|
|
/// <summary>Maximum number of concurrent pending commands.</summary>
|
|
public int MaxPendingCommands { get; init; }
|
|
|
|
/// <summary>
|
|
/// Server-031: ceiling on the in-flight-command heartbeat-skip. When
|
|
/// a command has been pending on the gateway↔worker pipe for longer
|
|
/// than this, the gateway-side <c>HeartbeatLoopAsync</c> fires the
|
|
/// <c>HeartbeatExpired</c> fault even if commands are still pending;
|
|
/// a truly stuck COM call shouldn't keep the watchdog suppressed
|
|
/// indefinitely. Mirrors Worker-023's <c>HeartbeatStuckCeiling</c> on
|
|
/// the worker side.
|
|
/// </summary>
|
|
public TimeSpan HeartbeatStuckCeiling { get; init; }
|
|
}
|