From 1fd8a803f16e7a1bee24512589aa84743571da5c Mon Sep 17 00:00:00 2001 From: Apollo3zehn Date: Tue, 26 Sep 2023 21:36:18 +0200 Subject: [PATCH] Fix remaining bugs --- .gitignore | 1 + tests/Nexus.Sources.Remote.Tests/dotnet/remote.cs | 12 +++++++++--- tests/Nexus.Sources.Remote.Tests/python/remote.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e95dc5b..4339ec8 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vs/ +.venv/ artifacts/ BenchmarkDotNet.Artifacts diff --git a/tests/Nexus.Sources.Remote.Tests/dotnet/remote.cs b/tests/Nexus.Sources.Remote.Tests/dotnet/remote.cs index e64818b..d3b47cc 100644 --- a/tests/Nexus.Sources.Remote.Tests/dotnet/remote.cs +++ b/tests/Nexus.Sources.Remote.Tests/dotnet/remote.cs @@ -1,4 +1,5 @@ -using System.Globalization; +using System.Buffers; +using System.Globalization; using System.Runtime.InteropServices; using Microsoft.Extensions.Logging; using Nexus.DataModel; @@ -265,8 +266,13 @@ void GenerateData(ReadRequest request, ReadOnlySpan dataFromNexus) foreach (var request in requests) { - var dataFromNexus = await readData("/need/more/data", begin, end, cancellationToken); - GenerateData(request, dataFromNexus.Span); + var length = (int)((end - begin).Ticks / request.CatalogItem.Representation.SamplePeriod.Ticks); + + using var memoryOwner = MemoryPool.Shared.Rent(length); + var buffer = memoryOwner.Memory.Slice(0, length); + + await readData("/need/more/data/1_s", begin, end, buffer, cancellationToken); + GenerateData(request, buffer.Span); } } } diff --git a/tests/Nexus.Sources.Remote.Tests/python/remote.py b/tests/Nexus.Sources.Remote.Tests/python/remote.py index 87257b8..92f3337 100644 --- a/tests/Nexus.Sources.Remote.Tests/python/remote.py +++ b/tests/Nexus.Sources.Remote.Tests/python/remote.py @@ -192,7 +192,7 @@ async def _read_and_modify_nexus_data( report_progress: Callable[[float], None]): for request in requests: - data_from_nexus = await read_data("/need/more/data", begin, end) + data_from_nexus = await read_data("/need/more/data/1_s", begin, end) double_data = request.data.cast("d") for i in range(0, len(double_data)):