diff options
author | Kornel <kornel@geekhood.net> | 2020-02-21 13:56:43 +0000 |
---|---|---|
committer | Kornel <kornel@geekhood.net> | 2020-02-21 13:57:20 +0000 |
commit | c94cf5f1d88b2828420b81afacceb531599f9d51 (patch) | |
tree | 6910d1bde06286ad6b054b66606ca81fe6631095 | |
parent | 24d92b63cca70149d5ee4a29c997b60e424ebbdc (diff) |
No rayon
-rw-r--r-- | crate_db/Cargo.toml | 1 | ||||
m--------- | crates_io_client | 10 | ||||
-rw-r--r-- | front_end/Cargo.toml | 1 | ||||
-rw-r--r-- | front_end/src/bin/crate_pages.rs | 61 | ||||
-rw-r--r-- | front_end/src/home_page.rs | 1 | ||||
-rw-r--r-- | ranking/Cargo.toml | 1 | ||||
-rw-r--r-- | reindex/src/bin/reindex_crates.rs | 1 | ||||
-rw-r--r-- | reindex/src/bin/reindex_users.rs | 2 | ||||
-rw-r--r-- | server/Cargo.toml | 3 |
9 files changed, 31 insertions, 50 deletions
diff --git a/crate_db/Cargo.toml b/crate_db/Cargo.toml index 74497da..44d0de2 100644 --- a/crate_db/Cargo.toml +++ b/crate_db/Cargo.toml @@ -14,7 +14,6 @@ rusqlite = "0.21.0" rich_crate = { path = "../rich_crate" } categories = { path = "../categories" } failure = "0.1.6" -rayon = "1.3.0" lazy_static = "1.4.0" chrono = "0.4.10" thread_local = "1.0.0" diff --git a/crates_io_client b/crates_io_client -Subproject 794aac9f4c58b7a5e23c9f224db2c8f51b6259b +Subproject f00bd76b7b9883a1b808c0fc335f4db4e690687 diff --git a/front_end/Cargo.toml b/front_end/Cargo.toml index 96eca42..3f272d7 100644 --- a/front_end/Cargo.toml +++ b/front_end/Cargo.toml @@ -19,7 +19,6 @@ render_readme = { git = "https://gitlab.com/crates.rs/render_readme.git", versio categories = { path = "../categories" } udedokei = { path = "../udedokei" } search_index = { path = "../search_index" } -rayon = "1.3.0" failure = "0.1.6" chrono = "0.4.10" semver = "0.9.0" diff --git a/front_end/src/bin/crate_pages.rs b/front_end/src/bin/crate_pages.rs index 744a6a8..c15d7a3 100644 --- a/front_end/src/bin/crate_pages.rs +++ b/front_end/src/bin/crate_pages.rs @@ -3,7 +3,6 @@ use front_end; use kitchen_sink; use kitchen_sink::RichCrate; use kitchen_sink::{stopped, KitchenSink, Origin}; -use rayon; use render_readme::{Highlighter, ImageOptimAPIFilter, Renderer}; use rich_crate::RichCrateVersion; use std::fs; @@ -60,47 +59,37 @@ async fn render(origin: &Origin, crates: &KitchenSink, path: &PathBuf, markup: & } async fn run(filter: Option<String>) -> Result<(), failure::Error> { - rayon::ThreadPoolBuilder::new().thread_name(|i| format!("rayon-{}", i)).build_global()?; - let crates = Arc::new(kitchen_sink::KitchenSink::new_default().await?); crates.prewarm(); let image_filter = Arc::new(ImageOptimAPIFilter::new("czjpqfbdkz", crates.main_cache_dir().join("images.db")).await?); let markup = &Renderer::new_filter(Some(Highlighter::new()), image_filter); - let handle = Arc::new(tokio::runtime::Handle::current()); - rayon::scope(move |s1| { - let tmp; - let always_render = filter.is_some(); - let all_crates = if let Some(filter) = &filter { - tmp = vec![if filter.contains(':') { - Origin::from_str(filter) - } else { - Origin::from_crates_io_name(filter) - }]; - Either::Left(tmp.into_iter()) + let tmp; + let always_render = filter.is_some(); + let all_crates = if let Some(filter) = &filter { + tmp = vec![if filter.contains(':') { + Origin::from_str(filter) } else { - Either::Right(crates.all_crates()) - }; - for origin in all_crates { - if stopped() { - break; + Origin::from_crates_io_name(filter) + }]; + Either::Left(tmp.into_iter()) + } else { + Either::Right(crates.all_crates()) + }; + for origin in all_crates { + if stopped() { + break; + } + let path = PathBuf::from(format!("public/crates/{}.html", origin.short_crate_name())); + if let Err(e) = render(&origin, &crates, &path, markup, always_render).await { + eprintln!("••• error: {} — {}", e, path.display()); + for c in e.iter_chain().skip(1) { + eprintln!("• error: -- {}", c); + } + if path.exists() { + std::fs::remove_file(path).ok(); } - let origin = origin.clone(); - let crates = Arc::clone(&crates); - let handle = Arc::clone(&handle); - let path = PathBuf::from(format!("public/crates/{}.html", origin.short_crate_name())); - s1.spawn(move |_| { - if let Err(e) = handle.enter(|| futures::executor::block_on(render(&origin, &crates, &path, markup, always_render))) { - eprintln!("••• error: {} — {}", e, path.display()); - for c in e.iter_chain().skip(1) { - eprintln!("• error: -- {}", c); - } - if path.exists() { - std::fs::remove_file(path).ok(); - } - } - }) } - Ok(()) - }) + } + Ok(()) } diff --git a/front_end/src/home_page.rs b/front_end/src/home_page.rs index 6721370..ec6b78e 100644 --- a/front_end/src/home_page.rs +++ b/front_end/src/home_page.rs @@ -9,7 +9,6 @@ use kitchen_sink::stopped; use kitchen_sink::CrateAuthor; use kitchen_sink::KitchenSink; use locale::Numeric; -use rayon::prelude::*; use rich_crate::Origin; use rich_crate::RichCrate; use rich_crate::RichCrateVersion; diff --git a/ranking/Cargo.toml b/ranking/Cargo.toml index a955419..f95b1ae 100644 --- a/ranking/Cargo.toml +++ b/ranking/Cargo.toml @@ -9,7 +9,6 @@ name = "ranking" path = "src/lib_ranking.rs" [dependencies] -rayon = "1.3.0" rich_crate = { path = "../rich_crate" } chrono = "0.4.10" cargo_toml = "0.8.0" diff --git a/reindex/src/bin/reindex_crates.rs b/reindex/src/bin/reindex_crates.rs index 2ae63d8..3d960b4 100644 --- a/reindex/src/bin/reindex_crates.rs +++ b/reindex/src/bin/reindex_crates.rs @@ -7,7 +7,6 @@ use parking_lot::Mutex; use rand::{seq::SliceRandom, thread_rng}; use ranking::CrateTemporalInputs; use ranking::CrateVersionInputs; -use rayon; use render_readme::Renderer; use search_index::*; use std::collections::HashSet; diff --git a/reindex/src/bin/reindex_users.rs b/reindex/src/bin/reindex_users.rs index 2bdc461..00577d1 100644 --- a/reindex/src/bin/reindex_users.rs +++ b/reindex/src/bin/reindex_users.rs @@ -1,5 +1,3 @@ -use rayon; - use kitchen_sink::{stopped, KitchenSink}; use std::{ collections::HashSet, diff --git a/server/Cargo.toml b/server/Cargo.toml index cbf6bf8..ac34a06 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crates-server" -version = "0.10.1" +version = "0.10.2" authors = ["Kornel <kornel@geekhood.net>"] edition = "2018" description = "Crates.rs web server" @@ -28,7 +28,6 @@ urlencoding = "1.0.0" failure = "0.1.5" tokio = { version = "0.2.11", features = ["rt-threaded", "macros", "time"] } categories = { path = "../categories" } -rayon = "1.3.0" arc-swap = "0.4.4" signal-hook = "0.1.12" locale = "0.2.2" |