diff --git a/src/ZB.MOM.WW.MxGateway.Server/Sessions/GatewaySession.cs b/src/ZB.MOM.WW.MxGateway.Server/Sessions/GatewaySession.cs index 70539f9..e211ab9 100644 --- a/src/ZB.MOM.WW.MxGateway.Server/Sessions/GatewaySession.cs +++ b/src/ZB.MOM.WW.MxGateway.Server/Sessions/GatewaySession.cs @@ -1672,34 +1672,7 @@ public sealed class GatewaySession } /// - /// Returns the worker client iff both the gateway-side session state AND - /// the worker client's own state are / - /// . The two states can diverge under - /// load: _state only transitions on gateway-driven events (open, - /// close, fault), while can shift on - /// worker-side signals (heartbeat watchdog, pipe disconnect) before the - /// gateway's session-level reaction observes them. When that happens the - /// in-flight RPC fails fast here with both states surfaced in the - /// diagnostic (Server-030) so the actual mismatch is actionable instead - /// of misleading. The session usually transitions to Faulted - /// shortly after. - /// - private IWorkerClient GetReadyWorkerClient() - { - lock (_syncRoot) - { - IWorkerClient? ready = EvaluateReadyUnderLock(out string? failureMessage); - if (ready is not null) - { - return ready; - } - - throw new SessionManagerException(SessionManagerErrorCode.SessionNotReady, failureMessage!); - } - } - - /// - /// Bounded, opt-in async variant of . When the + /// Bounded, opt-in async variant of the fail-fast readiness check. When the /// session is but the worker has transiently diverged /// to a non-terminal state (/ /// ) and the configured worker-ready wait timeout @@ -1742,7 +1715,11 @@ public sealed class GatewaySession DateTimeOffset deadline = _eventStreaming.TimeProvider.GetUtcNow() + _workerReadyWaitTimeout; while (true) { - await Task.Delay(pollIntervalMs, cancellationToken).ConfigureAwait(false); + await Task.Delay( + TimeSpan.FromMilliseconds(pollIntervalMs), + _eventStreaming.TimeProvider, + cancellationToken) + .ConfigureAwait(false); lock (_syncRoot) {