You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/05/10 11:22:58 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4161: Object Store (AWS): Support region configured via named profile

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org