Closed ben-propflo closed 1 year ago
Hi @ben-propflo,
Thank you for using our client.
Our intention is for the client to be used as a singleton
- a long-lived
client. You can find the client initialization here: https://github.com/bonitoo-io/influxdb3-csharp/blob/75cc2f7c88fc8c1ec039d83a1ef6be474469a55f/Client/InfluxDBClient.cs#L315.
Best
Great thanks @bednar. I was going to raise a PR to fix the bit about respecting DNS changes but it appears netstandard doesn't expose the property required. This sums it up nicely https://github.com/dotnet/aspnetcore/issues/28385#issuecomment-853766480
Currently I'm creating a new InfluxDBClient for each query/write but it may be beneficial to re-use the same instance. HttpClient can reuse the connection for example. I'm not so sure reusing the instance will work as intended given the usage of HttpClient doesn't appear to follow the current guidelines. The easiest solution would be to implement IHttpClientFactory I reckon. It'll be nice to specify in the docs if reuse is supported, and perhaps look into making it reusable if that currently isn't the case.