feat(dcl): bound per-tag seed ReadAsync with SeedReadTimeout (#232, DCL-027)

This commit is contained in:
Joseph Doherty
2026-06-19 01:35:40 -04:00
parent b432c788c3
commit 7c1d61647e
11 changed files with 36 additions and 9 deletions
@@ -780,9 +780,16 @@ public class DataConnectionActor : UntypedActor, IWithStash, IWithTimers
{
foreach (var tagPath in pending.ToList())
{
// DataConnectionLayer-027: bound each per-tag read with SeedReadTimeout so a
// hung device read cannot delay SubscribeCompleted/the ack indefinitely.
// On timeout the catch block treats it identically to any other failed seed
// read — the tag stays in pending, is retried up to SeedReadMaxAttempts, and
// left Uncertain if still empty after the budget. Same CancellationTokenSource
// mechanism used by HandleWrite for WriteTimeout (DataConnectionLayer-005).
using var cts = new CancellationTokenSource(_options.SeedReadTimeout);
try
{
var readResult = await adapter.ReadAsync(tagPath);
var readResult = await adapter.ReadAsync(tagPath, cts.Token);
if (readResult.Success && readResult.Value is { Value: not null } value)
{
seedValues.Add(new SeededValue(tagPath, value));
@@ -792,6 +799,7 @@ public class DataConnectionActor : UntypedActor, IWithStash, IWithTimers
catch
{
// Best-effort read — retried below, or logged once the budget is spent.
// Includes OperationCanceledException on SeedReadTimeout expiry.
}
}