Skip to content

Commit a165fae

Browse files
committed
migr
1 parent 067c67b commit a165fae

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/utils/consistency/index.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
use super::data::{Crate, Crates, Release, Releases};
2-
use crate::{Config, utils::spawn_blocking};
2+
use crate::{Config, utils::run_blocking_scoped};
33
use anyhow::Result;
44
use rayon::iter::ParallelIterator;
55
use tracing::debug;
66

77
pub(super) async fn load(config: &Config) -> Result<Crates> {
8-
let path = config.registry_index_path.clone();
9-
10-
// crates_index requires the repo url to match the existing origin or it tries to reinitialize the repo
11-
let repo_url = config
12-
.registry_url
13-
.as_deref()
14-
.unwrap_or("https://github.com/rust-lang/crates.io-index")
15-
.to_owned();
16-
17-
spawn_blocking(move || {
8+
run_blocking_scoped("load-crates-index", || {
189
debug!("Opening with `crates_index`");
19-
let mut index = crates_index::GitIndex::with_path(&path, repo_url)?;
10+
let mut index = crates_index::GitIndex::with_path(
11+
&config.registry_index_path,
12+
// crates_index requires the repo url to match the existing origin or it tries to reinitialize the repo
13+
config
14+
.registry_url
15+
.as_deref()
16+
.unwrap_or("https://github.com/rust-lang/crates.io-index"),
17+
)?;
18+
2019
index.update()?;
2120

2221
let mut result: Crates = index

src/utils/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ where
140140
/// - `render_in_threadpool` (continious load like rendering)
141141
/// - `run_blocking_scoped` (sporadic CPU bound load)
142142
///
143-
/// The thread-name will help us better seeing where our CPU load is coming from.
143+
/// The thread-name will help us better seeing where our CPU load is coming from on the
144+
/// servers.
144145
///
145146
/// Also, "look Ma, no 'static" because of thread::scope.
146147
pub(crate) async fn run_blocking_scoped<N, R, F>(name: N, f: F) -> Result<R>

0 commit comments

Comments
 (0)