Skip to content

Commit 7b751fc

Browse files
msuozzosylvestre
authored andcommitted
Fix sync GCS initialization
GCS usage currently fails as the initializtion path happens outside of a Tokio runtime context.
1 parent 2b65ac8 commit 7b751fc

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/cache/gcs.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ impl GCSCache {
6464
.map_err(|err| anyhow!("gcs credential url is invalid: {err:?}"))?;
6565

6666
// For TaskCluster integration, fetch token directly and provide it to OpenDAL
67-
let token = tokio::task::block_in_place(|| {
68-
tokio::runtime::Handle::current()
69-
.block_on(fetch_taskcluster_token(cred_url, rw_to_scope(rw_mode)))
70-
})
71-
.map_err(|e| anyhow!("Failed to fetch TaskCluster token: {e}"))?;
67+
let token = tokio::runtime::Builder::new_current_thread()
68+
.enable_all()
69+
.build()
70+
.map_err(|e| anyhow!("Failed to create runtime for token fetch: {e}"))?
71+
.block_on(fetch_taskcluster_token(cred_url, rw_to_scope(rw_mode)))
72+
.map_err(|e| anyhow!("Failed to fetch TaskCluster token: {e}"))?;
7273
builder = builder.token(token);
7374
}
7475

0 commit comments

Comments
 (0)