Skip to content

Commit

Permalink
feat(maintainer): s/parallelism/concurrency/g
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Mar 1, 2023
1 parent fa109bf commit 17e1fb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions crates/node-maintainer/src/maintainer.rs
Expand Up @@ -22,7 +22,7 @@ use crate::edge::{DepType, Edge};
use crate::error::NodeMaintainerError;
use crate::{Graph, IntoKdl, Lockfile, LockfileNode, Node};

const DEFAULT_PARALLELISM: usize = 50;
const DEFAULT_CONCURRENCY: usize = 50;

#[derive(Debug, Clone)]
pub struct ModuleInfo {
Expand All @@ -33,7 +33,7 @@ pub struct ModuleInfo {
#[derive(Debug, Clone)]
pub struct NodeMaintainerOptions {
nassun_opts: NassunOpts,
parallelism: usize,
concurrency: usize,
kdl_lock: Option<Lockfile>,
npm_lock: Option<Lockfile>,

Expand All @@ -57,8 +57,8 @@ impl NodeMaintainerOptions {
self
}

pub fn parallelism(mut self, parallelism: usize) -> Self {
self.parallelism = parallelism;
pub fn concurrency(mut self, concurrency: usize) -> Self {
self.concurrency = concurrency;
self
}

Expand Down Expand Up @@ -103,7 +103,7 @@ impl NodeMaintainerOptions {
let mut nm = NodeMaintainer {
nassun,
graph: Default::default(),
parallelism: DEFAULT_PARALLELISM,
concurrency: self.concurrency,
#[cfg(not(target_arch = "wasm32"))]
progress_bar: self.progress_bar,
};
Expand All @@ -124,7 +124,7 @@ impl NodeMaintainerOptions {
let mut nm = NodeMaintainer {
nassun,
graph: Default::default(),
parallelism: DEFAULT_PARALLELISM,
concurrency: self.concurrency,
#[cfg(not(target_arch = "wasm32"))]
progress_bar: self.progress_bar,
};
Expand All @@ -142,7 +142,7 @@ impl Default for NodeMaintainerOptions {
fn default() -> Self {
NodeMaintainerOptions {
nassun_opts: Default::default(),
parallelism: DEFAULT_PARALLELISM,
concurrency: DEFAULT_CONCURRENCY,
kdl_lock: None,
npm_lock: None,
#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -162,7 +162,7 @@ struct NodeDependency {
pub struct NodeMaintainer {
nassun: Nassun,
graph: Graph,
parallelism: usize,
concurrency: usize,
#[cfg(not(target_arch = "wasm32"))]
progress_bar: bool,
}
Expand Down Expand Up @@ -263,7 +263,7 @@ impl NodeMaintainer {
stream
.map(|idx| Ok((idx, concurrent_count.clone(), total_completed.clone())))
.try_for_each_concurrent(
me.parallelism,
me.concurrency,
move |(child_idx, concurrent_count, total_completed)| async move {
if child_idx == me.graph.root {
return Ok(());
Expand Down Expand Up @@ -383,8 +383,8 @@ impl NodeMaintainer {
})
.filter_map(|maybe_spec| maybe_spec)
.map(|spec| self.nassun.resolve(spec.clone()).map_ok(move |p| (p, spec)))
.buffer_unordered(self.parallelism)
.ready_chunks(self.parallelism);
.buffer_unordered(self.concurrency)
.ready_chunks(self.concurrency);

// Start iterating over the queue. We'll be adding things to it as we find them.
while !q.is_empty() || in_flight != 0 {
Expand Down
6 changes: 3 additions & 3 deletions crates/node-maintainer/tests/resolver_basic.rs
Expand Up @@ -40,7 +40,7 @@ async fn basic_flatten() -> Result<()> {
"#;
mocks_from_kdl(&mock_server, mock_data.parse()?).await;
let nm = NodeMaintainer::builder()
.parallelism(1)
.concurrency(1)
.registry(mock_server.uri().parse().into_diagnostic()?)
.resolve_spec("a@^1")
.await?;
Expand Down Expand Up @@ -116,7 +116,7 @@ async fn nesting_simple_conflict() -> Result<()> {
"#;
mocks_from_kdl(&mock_server, mock_data.parse()?).await;
let nm = NodeMaintainer::builder()
.parallelism(1)
.concurrency(1)
.registry(mock_server.uri().parse().into_diagnostic()?)
.resolve_spec("a@^1")
.await?;
Expand Down Expand Up @@ -198,7 +198,7 @@ async fn nesting_sibling_conflict() -> Result<()> {
"#;
mocks_from_kdl(&mock_server, mock_data.parse()?).await;
let nm = NodeMaintainer::builder()
.parallelism(1)
.concurrency(1)
.registry(mock_server.uri().parse().into_diagnostic()?)
.resolve_spec("a@^1")
.await?;
Expand Down

0 comments on commit 17e1fb4

Please sign in to comment.