File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 11use super :: data:: { Crate , Crates , Release , Releases } ;
2- use crate :: { Config , utils:: spawn_blocking } ;
2+ use crate :: { Config , utils:: run_blocking_scoped } ;
33use anyhow:: Result ;
44use rayon:: iter:: ParallelIterator ;
55use tracing:: debug;
66
77pub ( 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
Original file line number Diff line number Diff 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.
146147pub ( crate ) async fn run_blocking_scoped < N , R , F > ( name : N , f : F ) -> Result < R >
You can’t perform that action at this time.
0 commit comments