perf(abcip): #1032 reuse the constant offset-0 read request per tag runtime; no boxed tuple per cancellable scheduler request
This commit is contained in:
+17
@@ -46,6 +46,23 @@ public sealed class LogixTagClientTests
|
||||
ch.Sent[0].ShouldBe(LogixServices.ReadTagFragmented(Path, 1, 0)); // libplctag's wire shape (golden captures)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Repeated_reads_reuse_the_offset_zero_request_and_a_changed_count_rebuilds_it()
|
||||
{
|
||||
var (ch, client, s) = Create();
|
||||
await using var _ = s;
|
||||
ch.RespondPerService = r => FakeCipChannel.Reply(r[0], 0x00, TypedData(LogixTypeCode.DInt, [1, 0, 0, 0]));
|
||||
|
||||
await client.ReadAsync(Path, 1, Ct);
|
||||
await client.ReadAsync(Path, 1, Ct);
|
||||
await client.ReadAsync(Path, 2, Ct);
|
||||
|
||||
ch.Sent.Count.ShouldBe(3);
|
||||
ch.Sent[0].ShouldBe(LogixServices.ReadTagFragmented(Path, 1, 0));
|
||||
ch.Sent[1].ShouldBe(LogixServices.ReadTagFragmented(Path, 1, 0));
|
||||
ch.Sent[2].ShouldBe(LogixServices.ReadTagFragmented(Path, 2, 0)); // not the stale cached request
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Fragmented_read_keeps_the_first_partial_and_continues()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user