tustvold commented on code in PR #4161:
URL: https://github.com/apache/arrow-rs/pull/4161#discussion_r1189761207


##########
object_store/src/aws/mod.rs:
##########
@@ -1094,12 +1103,36 @@ impl AmazonS3Builder {
     }
 }
 
+#[cfg(feature = "aws_profile")]
+fn profile_region(profile: String) -> Option<String> {
+    use std::{panic, thread};
+    use tokio::runtime::Handle;
+
+    let handle = Handle::current();
+    let provider = profile::ProfileProvider::new(profile, None);
+
+    let result = thread::spawn(move || handle.block_on(provider.get_region()));
+
+    match result.join() {
+        Ok(region) => region,
+        Err(e) => panic::resume_unwind(e),
+    }

Review Comment:
   ```suggestion
       handle.block_on(provider.get_region())
   ```
   
   Both are equally "problematic" in that they pin a tokio worker, but this at 
least avoids spawning an additional thread



-- 
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]

Reply via email to