fix(comm): key site liveness on central receive time; gRPC connect timeout + connect-phase deadline failover (COMM-4, COMM-5, WP4 task 4.4)

This commit is contained in:
Joseph Doherty
2026-12-03 09:52:54 -05:00
parent c1db7094eb
commit f02fe9d696
18 changed files with 350 additions and 38 deletions
@@ -322,6 +322,17 @@ public sealed class SitePairChannelProvider : IDisposable
if (primaryIsA) ConfirmFailback(pair);
return result;
}
catch (RpcException ex) when (secondary is not null && GrpcRetrySafety.IsConnectPhaseDeadline(ex, primary))
{
// COMM-5: the deadline expired while the node was still not accepting a connection
// (black-holed host, deadline shorter than the connect timeout). Move the pair so the
// next call goes to the other node; the spent deadline leaves nothing to retry with.
FlipTo(pair, toIsA: !primaryIsA);
_logger.LogWarning(
"Site {TargetSiteId} node {FromNode} did not accept a connection before the call deadline; next calls go to node {ToNode}",
siteId, primaryIsA ? "A" : "B", primaryIsA ? "B" : "A");
throw;
}
catch (RpcException ex) when (ex.StatusCode == StatusCode.Unavailable)
{
if (secondary is not null) FlipTo(pair, toIsA: !primaryIsA);
@@ -586,6 +597,7 @@ public sealed class SitePairChannelProvider : IDisposable
{
KeepAlivePingDelay = _options.GrpcKeepAlivePingDelay,
KeepAlivePingTimeout = _options.GrpcKeepAlivePingTimeout,
ConnectTimeout = _options.GrpcConnectTimeout,
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always,
EnableMultipleHttp2Connections = true
}