fix(mqtt): review minors - QoS 0 is not answer evidence, caller cancels stay cancels, rebirth wait cap, bound/trie pins (R06 G2 MQTT review minors 2 3 4 6 7 8)
2: only a PUBACKed (QoS >= 1) publish advances LastSuccessfulRead; a QoS 0 Sparkplug command completing means only that the bytes left the local socket. 3: a no-verdict SUBSCRIBE caused by the caller's own cancellation now throws OperationCanceledException (refs still Bad + pending), so the breaker no longer counts a pipeline timeout as a failure. 4: the rebirth wait is the window capped at 15 s, below the AdminUI 20 s per-call timeout. 6: a 10-topic test pins the 8-in-flight publish bound. 7: partial-level wildcards and $share filters are pinned never to confirm. 8: the intended init-vs-shutdown supersede is commented at the re-check. Refs #744 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
@@ -454,6 +454,10 @@ public sealed class MqttSubscriptionManager
|
||||
|
||||
if (outcome.TransportFailure is { } failure)
|
||||
{
|
||||
// The refs are already Bad and pending either way. But a cancel of the CALLER's token (a pipeline
|
||||
// timeout, host shutdown) is a cancellation, not a broker fault: surfacing it as
|
||||
// InvalidOperationException made the resilience breaker count it as a failure (review minor 3).
|
||||
var callerCancelled = cancellationToken.IsCancellationRequested;
|
||||
// No verdict at all (transport throw / SUBSCRIBE deadline): THROW, so the caller holds no handle
|
||||
// and DriverInstanceActor's health-tick reconcile re-subscribes. Returning a handle here was the
|
||||
// silent-death case — the actor thought the subscription live and never retried. The refs already
|
||||
@@ -464,6 +468,15 @@ public sealed class MqttSubscriptionManager
|
||||
_handleByRawPath.TryRemove(new KeyValuePair<string, ISubscriptionHandle>(def.Name, handle));
|
||||
}
|
||||
|
||||
if (callerCancelled)
|
||||
{
|
||||
throw new OperationCanceledException(
|
||||
$"MQTT driver '{_driverId}': SUBSCRIBE for {pending.Count} tag(s) was cancelled by the caller; "
|
||||
+ "the topics stay pending and will be retried.",
|
||||
failure,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
throw new InvalidOperationException(
|
||||
$"MQTT driver '{_driverId}': SUBSCRIBE for {pending.Count} tag(s) got no broker verdict "
|
||||
+ $"({failure.GetType().Name}); the subscription will be retried.",
|
||||
|
||||
Reference in New Issue
Block a user