fix(deploy): #1116 log a deadline/cancel dispatch as delivery-outcome-unknown, not NOT delivered
This commit is contained in:
@@ -628,6 +628,17 @@ public sealed class CentralCommunicationActor : ReceiveActor, IWithTimers
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsDeliveryOutcomeUnknown(result.FailureStatus))
|
||||
{
|
||||
_log.Warning(
|
||||
"Mesh: {CommandType} (correlationId={CorrelationId}) delivery outcome unknown to {NodeId} "
|
||||
+ "({Status}: {Detail}) \u2014 the node may have received and applied it; the deploy coordinator's "
|
||||
+ "re-send/ack will settle it (#1107)",
|
||||
result.CommandType, result.CorrelationId, result.NodeId,
|
||||
result.FailureStatus, result.FailureDetail);
|
||||
return;
|
||||
}
|
||||
|
||||
_log.Warning(
|
||||
"Mesh: {CommandType} (correlationId={CorrelationId}) was NOT delivered to {NodeId} "
|
||||
+ "({Status}: {Detail}). This actor does not retry it; a deployment is re-sent by the deploy "
|
||||
@@ -637,6 +648,17 @@ public sealed class CentralCommunicationActor : ReceiveActor, IWithTimers
|
||||
result.FailureStatus, result.FailureDetail);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #1116: a gRPC client deadline / cancellation can expire after the node already received (and applied) the
|
||||
/// command, so <c>Cancelled</c> / <c>DeadlineExceeded</c> (the dispatch also maps a dial timeout to
|
||||
/// <c>Cancelled</c>) are "outcome unknown", not "not delivered".
|
||||
/// Statuses such as <c>Unavailable</c> (no connection) guarantee non-delivery.
|
||||
/// </summary>
|
||||
/// <param name="failureStatus">The recorded failure status text, or null.</param>
|
||||
/// <returns>True when delivery may still have happened.</returns>
|
||||
public static bool IsDeliveryOutcomeUnknown(string? failureStatus)
|
||||
=> failureStatus is "Cancelled" or "DeadlineExceeded";
|
||||
|
||||
private void HandleApplyAck(ApplyAck ack)
|
||||
{
|
||||
var coordinator = _coordinator();
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.ControlPlane.Communication;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.ControlPlane.Tests.Communication;
|
||||
|
||||
public sealed class DeliveryOutcomeClassificationTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Cancelled")]
|
||||
[InlineData("DeadlineExceeded")]
|
||||
public void Deadline_or_cancel_is_outcome_unknown(string status)
|
||||
=> CentralCommunicationActor.IsDeliveryOutcomeUnknown(status).ShouldBeTrue();
|
||||
|
||||
[Theory]
|
||||
[InlineData("Unavailable")]
|
||||
[InlineData("Unknown")]
|
||||
[InlineData("InvalidArgument")]
|
||||
[InlineData(null)]
|
||||
public void Other_statuses_stay_not_delivered(string? status)
|
||||
=> CentralCommunicationActor.IsDeliveryOutcomeUnknown(status).ShouldBeFalse();
|
||||
}
|
||||
Reference in New Issue
Block a user