plusplusjiajia commented on code in PR #2838:
URL: https://github.com/apache/iceberg-rust/pull/2838#discussion_r3688018943


##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -231,9 +252,13 @@ impl RestCatalogConfig {
         ])
     }
 
-    /// Get the client from the config.
-    pub(crate) fn client(&self) -> Option<Client> {
-        self.client.clone()
+    /// The HTTP client: the configured one, or a lazily-created default that
+    /// is shared across every user of this config (and its clones), so token
+    /// and catalog requests keep sharing one connection pool.
+    pub(crate) fn client(&self) -> Client {
+        self.client
+            .clone()
+            .unwrap_or_else(|| 
self.default_client.get_or_init(Client::default).clone())

Review Comment:
   @CTTY Good question — unwrap_or_default builds a new connection pool per 
call; the OnceLock shares one client across config clones (OAuth + catalog 
traffic, same pool as before the refactor).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to