feat(resilience): #1047 non-retrying AcquisitionSubscribe capability wraps SubscribeAcquisitionAsync (breaker + /hosts telemetry), OTOPCUA0001 suppression removed
New DriverCapability.AcquisitionSubscribe (appended): RetryCount 0 in every tier and forced 0 by the parser, 30 s timeout (outlasts the actor's 10 s acquisition timeout), breaker 5 (Tier C none). PendingAcquisition.Start routes through the invoker keyed on the driver instance; an open breaker fails fast and the capacity reservation is released. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2246,19 +2246,19 @@ public sealed class DriverInstanceActor : ReceiveActor, IWithTimers
|
||||
_finished.TrySetResult(true);
|
||||
}
|
||||
|
||||
// OTOPCUA0001 (#1001/S-11) is suppressed here ON PURPOSE, not overlooked. The stock Subscribe
|
||||
// pipeline cannot wrap this call safely: it retries (3x on tiers A/B) and times out per attempt
|
||||
// (5-8 s, shorter than the actor's 10 s acquisition timeout), but a SubscribeAcquisitionAsync
|
||||
// attempt that is cancelled or superseded may still complete later with a physical handle, and
|
||||
// the contract makes THIS class (PendingAcquisition) the sole owner of releasing it. A Polly
|
||||
// retry/timeout would orphan those handles and desync the capacity reservation. Establishment
|
||||
// is already bounded by the actor's own acquisition timeout + the _stop token. Follow-up: give
|
||||
// the invoker a non-retrying acquisition capability so breaker/telemetry cover it too.
|
||||
// #1047 (#1001/S-11 follow-up): wrapped on its OWN capability, AcquisitionSubscribe, which never retries
|
||||
// (the parser forces 0) and whose 30 s tier timeout outlasts the actor's 10 s acquisition timeout. The stock
|
||||
// Subscribe pipeline could not wrap this: it retries, and a SubscribeAcquisitionAsync attempt that is cancelled
|
||||
// or superseded may still complete with a physical handle THIS class alone must release — a retry would orphan
|
||||
// it. With no retry the pipeline is transparent to that contract (Polly's timeout awaits the call and passes a
|
||||
// completed result through; only an OCE becomes TimeoutRejectedException, an ordinary failure here), and the
|
||||
// breaker + /hosts telemetry now cover acquisition. An open breaker fails fast without calling the source, which
|
||||
// ObserveAsync handles like any failure (reservation released). Keyed on the driver instance like a bulk Subscribe.
|
||||
internal void Start(IAcknowledgedAcquisitionSource source, AcquisitionSubscriptionRequest request,
|
||||
Action<AcquisitionBatch> callback) => _ = ObserveAsync(Task.Run(() =>
|
||||
#pragma warning disable OTOPCUA0001
|
||||
source.SubscribeAcquisitionAsync(request, callback, _stop.Token)));
|
||||
#pragma warning restore OTOPCUA0001
|
||||
Action<AcquisitionBatch> callback, IDriverCapabilityInvoker invoker, string hostKey) => _ = ObserveAsync(Task.Run(async () =>
|
||||
await invoker.ExecuteAsync(DriverCapability.AcquisitionSubscribe, hostKey,
|
||||
async ct => await source.SubscribeAcquisitionAsync(request, callback, ct).ConfigureAwait(false),
|
||||
_stop.Token).ConfigureAwait(false)));
|
||||
|
||||
private async Task ObserveAsync(Task<AcquisitionSubscriptionResult> operation)
|
||||
{
|
||||
@@ -2418,7 +2418,7 @@ public sealed class DriverInstanceActor : ReceiveActor, IWithTimers
|
||||
else _sourcePublisher.TryPublish(ticket, item.Snapshot);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, _invoker, _driverInstanceId);
|
||||
started = true;
|
||||
var installed = await operation.Completion.WaitAsync(cts.Token);
|
||||
if (installed.Handle is null || installed.DesiredRevision != fence.Revision ||
|
||||
|
||||
Reference in New Issue
Block a user