ursus
05/26/2025, 6:33 PMval ktorClient2 = ktorClient.config { .. }
am I sharing some resources under the hood or is it completely a deep copy?
I'm asking since I have a single instance shared all across the app, but a for set of apis the host changes.
I know I can spell out the full url in those apis, but creating a client per that set of apis with a single default request config would be more elegant
And the question is how expensive is this "scoped" ktor instanceAleksei Tirman [JB]
05/27/2025, 8:00 AMursus
05/27/2025, 2:51 PMAleksei Tirman [JB]
05/27/2025, 2:53 PMdoes it matter if engine is shared?Do you mean matters for what?
ursus
05/27/2025, 2:54 PMAleksei Tirman [JB]
05/27/2025, 2:57 PMursus
05/27/2025, 2:58 PMAleksei Tirman [JB]
05/27/2025, 3:00 PMursus
05/27/2025, 3:00 PMursus
05/27/2025, 3:01 PMAleksei Tirman [JB]
05/27/2025, 3:02 PMursus
05/27/2025, 3:02 PMursus
05/27/2025, 3:03 PMval authRetrofit = appRetrofit.newBuilder()
.baseUrl(baseAuthUrl)
.build()
for example; this shares all the interceptor instances, just swaps the base url bitAleksei Tirman [JB]
05/27/2025, 3:05 PMDefaultRequest
is a plugin, and unfortunately, there is no mechanism to uninstall a plugin.ursus
05/27/2025, 3:06 PMconfig { .. }
lambda
I presume it's not 2 then in the plugins collectionursus
05/27/2025, 3:07 PMnewClient(overridenPlugin ?: previousInstance.plugin)
Aleksei Tirman [JB]
05/28/2025, 7:38 AM