Ioannis Mavroukakis
09/21/2022, 2:11 PMHttpClient
re-use. What is the accepted wisdom here? Create a new one as needed, or never close()
the existing one? What do people do? Thanks!shaktiman_droid
09/21/2022, 2:40 PMshaktiman_droid
09/21/2022, 2:40 PMshaktiman_droid
09/21/2022, 2:40 PMNote that creatingis not a cheap operation, and it’s better to reuse its instance in the case of multiple requests.HttpClient
shaktiman_droid
09/21/2022, 2:41 PMuse
, so you don’t have to worry about closing manually
val status = HttpClient().use { client ->
// ...
}
Ioannis Mavroukakis
09/21/2022, 2:42 PMshaktiman_droid
09/21/2022, 2:49 PMIoannis Mavroukakis
09/21/2022, 2:50 PMshaktiman_droid
09/21/2022, 2:54 PMclose
when you absolutely don’t need itshaktiman_droid
09/21/2022, 2:54 PMIoannis Mavroukakis
09/21/2022, 3:05 PMLuiz Aguiar
09/22/2022, 2:26 PMJorge Bo
09/22/2022, 5:00 PM