Closed vasily-kirichenko closed 6 years ago
Yes, it is idiomatic to create it once per distinct cluster/datacenter connection and then reuse it forever. It's mostly that way due to the fact that HttpClient should be used in that way as well.
@highlyunavailable I'm not sure I understand you. I do reuse the client and it dies.
Re-make the request then? Or is the problem that you can no longer issue any requests?
The error Unexpected response, status code InternalServerError: rpc error making call: EOF
means that Consul itself is encountering an error - the words "rpc error making call: EOF" are from Go.
https://github.com/Horusiath/Akka.Cluster.Discovery uses this client, see https://github.com/Horusiath/Akka.Cluster.Discovery/blob/ca04b544568fe700355d30a131b8a8362e7ae1fc/src/Akka.Cluster.Discovery.Consul/ConsulDiscoveryService.cs#L34. After a week of running without problems, I got the following exception:
(it's thrown here https://github.com/Horusiath/Akka.Cluster.Discovery/blob/ca04b544568fe700355d30a131b8a8362e7ae1fc/src/Akka.Cluster.Discovery.Consul/ConsulDiscoveryService.cs#L57)
Is it idiomatic to use
ConsulClient
this way (I mean create it once and use forever)? If it's not, is creating an instance for each request a nice idea? I see all the state is lazy, so I suspect it's quite expensive to recreate every time?