fix(historian): #691.4 review — uncapped Gateway events reads no longer pre-size to int.MaxValue

GatewayHistorianDataSource.ReadEventsAsync sized its result list to
maxEvents, which is int.MaxValue for NumValuesPerNode = 0: every
uncapped Gateway events read (forward on master, and the new walked
reverse one) threw 'Array dimensions exceeded' and counted as a backend
failure. Capacity is bounded at 1024. The events walk delegate moved to
ReverseEventsReader so it is tested over the real Gateway source
(forward uncapped, reverse uncapped, reverse capped).
This commit is contained in:
Joseph Doherty
2026-10-12 17:20:41 -04:00
parent d277f34a96
commit ccda27d220
6 changed files with 142 additions and 18 deletions
@@ -54,6 +54,9 @@ public sealed class FakeHistorianGatewayClient : IHistorianGatewayClient
public int LastReadEventsMaxEvents;
public int ReadEventsCallCount;
/// <summary>When set, ReadEvents serves <c>EventsSource(start, end)</c> instead of <see cref="Events"/>.</summary>
public Func<DateTime, DateTime, IEnumerable<HistorianEvent>>? EventsSource;
/// <summary>Thrown (deferred to first enumeration) by every read method when set.</summary>
public Exception? ThrowOnRead;
@@ -187,7 +190,7 @@ public sealed class FakeHistorianGatewayClient : IHistorianGatewayClient
LastReadEventsEndUtc = endUtc;
LastReadEventsMaxEvents = maxEvents;
ReadEventsCallCount++;
return ToAsyncStream(Events, ThrowOnRead, ct);
return ToAsyncStream(EventsSource is null ? Events : EventsSource(startUtc, endUtc).ToList(), ThrowOnRead, ct);
}
public Task<WriteAck> WriteLiveValuesAsync(