You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be a good idea to create a static HttpClient and reuse it, without disposing of it.
You also might want to consider using something like DragonFruit.Common, which simplifies all of this into classes where the requests are generated and the client disposal/management are done for you. (should you want to use this I can explain how to use it)
HttpClients are designed to be reused, and as such shouldn't be disposed of:https://github.com/abuZayed15/check-link/blob/d57972cb7c91e0cfcef709e62cb600e5112fb832/CheckLinkCLI2/CheckLinkCLI2/WebLinkChecker.cs#L67-L70 https://github.com/abuZayed15/check-link/blob/d57972cb7c91e0cfcef709e62cb600e5112fb832/CheckLinkCLI2/CheckLinkCLI2/WebLinkChecker.cs#L161-L164
I think it would be a good idea to create a static
HttpClientand reuse it, without disposing of it.You also might want to consider using something like DragonFruit.Common, which simplifies all of this into classes where the requests are generated and the client disposal/management are done for you. (should you want to use this I can explain how to use it)
Also worth noting you need to dispose of the
HttpResponseMessages:https://github.com/abuZayed15/check-link/blob/d57972cb7c91e0cfcef709e62cb600e5112fb832/CheckLinkCLI2/CheckLinkCLI2/WebLinkChecker.cs#L76 https://github.com/abuZayed15/check-link/blob/d57972cb7c91e0cfcef709e62cb600e5112fb832/CheckLinkCLI2/CheckLinkCLI2/WebLinkChecker.cs#L166