Skip to content

Commit 9bf5166

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

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/bin/crates-admin/upload_index.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use crate::dialoguer;
2-
use anyhow::{anyhow, Context};
2+
use anyhow::anyhow;
33
use crates_io::storage::Storage;
44
use crates_io::tasks::spawn_blocking;
55
use crates_io_index::{Repository, RepositoryConfig};
66
use indicatif::{ProgressBar, ProgressIterator, ProgressStyle};
7+
use tokio::runtime::Handle;
78

89
#[derive(clap::Parser, Debug)]
910
#[command(
@@ -31,11 +32,6 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
3132
return Ok(());
3233
}
3334

34-
let rt = tokio::runtime::Builder::new_current_thread()
35-
.enable_all()
36-
.build()
37-
.context("Failed to initialize tokio runtime")?;
38-
3935
let pb = ProgressBar::new(files.len() as u64);
4036
pb.set_style(ProgressStyle::with_template(
4137
"{bar:60} ({pos}/{len}, ETA {eta})",
@@ -59,7 +55,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
5955
}
6056

6157
let contents = std::fs::read_to_string(&path)?;
62-
rt.block_on(storage.sync_index(crate_name, Some(contents)))?;
58+
Handle::current().block_on(storage.sync_index(crate_name, Some(contents)))?;
6359
}
6460

6561
println!(

0 commit comments

Comments
 (0)