Write call gets calceled by system

I ran into this problem and spend a couple of hours trying to figure out a solution and I think i finally did.
I found that every once in a while my write-task would get cancled seemingly randomly, as I didn’t specify a cancelationtoken and even when I did it kept getting cancled.

What I think my problem was is that i was using the influx client incorrectly, because even though it implements the IDisposable Interface it does not want to be disposed of. In all tutorials the client is initialized like this:
using var client = InfluxDBClientFactory.Create(“http://localhost:8086”, token);
I instead initialized it like this, thinking the two were equivalent:
using(var client = …) { … }
As I understand it this results in all open requests being enden as soon as the using statement closes, in my case resulting in a seemingly random cancelation of active tasks.

I came to this conclusion based on this article:

Hi @TomsCodingCode,

thanks for using our client.

The client creates own instance of HttpClient which is bound to “lifecycle” of the client. For the correct usage the client should be shared singleton and closed at the end of app lifecycle.

Regards