influxdata / influxdb-client-csharp

InfluxDB 2.x C# Client
https://influxdata.github.io/influxdb-client-csharp/api/InfluxDB.Client.html
MIT License
355 stars 95 forks source link

feat: Use IEnumerable in WriteApi to eliminate unnecessary memory all… #615

Open birdalicious opened 7 months ago

birdalicious commented 7 months ago

Proposed Changes

Change WriteApi to use IEnumerable for collection arguments instead of List. Change WriteRecords(List<string> records) to WriteRecords(IEnumerable<string> records)

Calling ToList on a collection will incur a memory allocation as the data is copied to the new list. Making the argument IEnumerable means ToList doesn't need to be called and so no extra memory allocation. Internally this will eliminate the unnecessary memory allocation in WriteRecords(string[] record) call to ToList, and client code also won't have to make the allocation if their data isn't already in a List## Checklist

Checklist

birdalicious commented 7 months ago

Sorry for the long delay in updating this PR. I've attempted to run the test suit but most the tests fail on The request was canceled due to the configured HttpClient.Timeout of 10 seconds elapsing. or similar error messages. I've checked the master branch also does this for me. Is there something I'm missing, I've ran the influx-restart.sh script and have the containers running.

bednar commented 6 months ago

Can you check that the InfluxDB 2 is running on the port 9999 by: curl -i -X GET 'http://localhost:9999/health' ?

birdalicious commented 6 months ago

It is running and the server replies, all three are up and replying

image
birdalicious commented 3 weeks ago

@bednar fixed the code formatting