refactor(historian): gate before translate (no discarded alloc on secondary) + strengthen double-write warning (review)
This commit is contained in:
+1
-3
@@ -29,12 +29,11 @@ public sealed class HistorianAdapterActorTests : RuntimeActorTestBase
|
||||
/// <summary>Thread-safe fake sink that records every <see cref="EnqueueAsync"/> call.</summary>
|
||||
private sealed class RecordingSink : IAlarmHistorianSink
|
||||
{
|
||||
private int _count;
|
||||
private readonly object _lock = new();
|
||||
private readonly List<AlarmHistorianEvent> _events = new();
|
||||
|
||||
/// <summary>The number of <see cref="EnqueueAsync"/> calls observed so far.</summary>
|
||||
public int EnqueueCount => Volatile.Read(ref _count);
|
||||
public int EnqueueCount { get { lock (_lock) { return _events.Count; } } }
|
||||
|
||||
/// <summary>A snapshot of every event enqueued so far (in arrival order).</summary>
|
||||
public IReadOnlyList<AlarmHistorianEvent> Events
|
||||
@@ -50,7 +49,6 @@ public sealed class HistorianAdapterActorTests : RuntimeActorTestBase
|
||||
_events.Add(evt);
|
||||
}
|
||||
|
||||
Interlocked.Increment(ref _count);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user