Replies: 1 comment
-
|
after doing more digging I can see the refit doesn't spawn new clients even if you call the for method many times. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a library that uses refit to create an sdk for integration to a 3rd party api. This is an old winforms project and does not contain any di containers or currently use httpclientfactory
It works fine but I have a question about the default implementation of refit.
If I have the following:
`public static IV12Api GetApi(string hostUrl)
{
var options = new JsonSerializerOptions()
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
}`
If I monitor connections on my machine I can see when I call the methods from the results above it creates a connection, does the request and then leaves the connection open for a few mins and does eventually close.
Is this okay to leave the client connected when the amount of calls will be little and not often. I could theoretically create the httpclient before each request(s) and pass it into refit and then close after the request(s) and handle it myself. Or am I best leaving it to refit to handle as is.
Beta Was this translation helpful? Give feedback.
All reactions