Leon Kiefer
10/28/2022, 2:19 PMStateFlow<HttpClient>
which returns/caches a client based on a Flow<HttpClientConfig>
so the client is update/a new client is created when the config is updated, but at the same time the old clients are cleaned up automatically, for example by the GC? In our use case we need to configure all our http clients dynamically during app runtime and the configuration is a Flow which can change at any time.Aleksei Tirman [JB]
10/31/2022, 11:11 AMLeon Kiefer
10/31/2022, 11:55 AMLeon Kiefer
10/31/2022, 11:58 AMLeon Kiefer
10/31/2022, 12:05 PMAleksei Tirman [JB]
10/31/2022, 12:57 PMHttpClient.close()
work for you to release an HTTP client that is no longer needed?Leon Kiefer
10/31/2022, 1:00 PMAleksei Tirman [JB]
10/31/2022, 1:04 PMHttpClient.close()
method does a graceful shutdown so open connections won’t be closed immediately.Leon Kiefer
10/31/2022, 1:27 PMclose()
must be called by the flow, before a new Client is created and returned by the flow, but if someone just got the latest client reference from the flow, no new requests can be created, this is a race condition between the flow closing the client and client being used to make requests.