Skip to content

Commit dda300e

Browse files
committed
admin/render_readmes: Remove redundant tokio runtime
There is already an outer runtime, so we don't need this one anymore :)
1 parent 9bf5166 commit dda300e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/bin/crates-admin/render_readmes.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use flate2::read::GzDecoder;
1919
use reqwest::{blocking::Client, header};
2020
use std::str::FromStr;
2121
use tar::{self, Archive};
22+
use tokio::runtime::Handle;
2223

2324
const USER_AGENT: &str = "crates-admin";
2425

@@ -121,17 +122,13 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
121122
println!("[{}-{}] Rendering README...", krate_name, version.num);
122123
let readme = get_readme(&storage, &client, &version, &krate_name)?;
123124
if !readme.is_empty() {
124-
let rt = tokio::runtime::Builder::new_current_thread()
125-
.enable_all()
126-
.build()
127-
.context("Failed to initialize tokio runtime")?;
128-
129-
rt.block_on(storage.upload_readme(
130-
&krate_name,
131-
&version.num,
132-
readme.into(),
133-
))
134-
.context("Failed to upload rendered README file to S3")?;
125+
Handle::current()
126+
.block_on(storage.upload_readme(
127+
&krate_name,
128+
&version.num,
129+
readme.into(),
130+
))
131+
.context("Failed to upload rendered README file to S3")?;
135132
}
136133

137134
Ok(())

0 commit comments

Comments
 (0)