mirror of
https://github.com/Hopiu/lychee.git
synced 2026-04-19 12:41:14 +00:00
Max concurrency moved to check (#419)
Concurrency is defined by the channel size consuming from the request stream in `check`
This commit is contained in:
parent
ec03c8d0f7
commit
c41ba64a69
3 changed files with 5 additions and 16 deletions
|
|
@ -17,7 +17,6 @@ async fn main() -> Result<()> {
|
|||
let links = Collector::new(
|
||||
None, // base
|
||||
false, // don't skip missing inputs
|
||||
10, // max concurrency
|
||||
)
|
||||
.collect_links(
|
||||
inputs, // base url or directory
|
||||
|
|
|
|||
|
|
@ -155,13 +155,9 @@ fn run_main() -> Result<i32> {
|
|||
|
||||
async fn run(opts: &LycheeOptions) -> Result<i32> {
|
||||
let inputs = opts.inputs();
|
||||
let requests = Collector::new(
|
||||
opts.config.base.clone(),
|
||||
opts.config.skip_missing,
|
||||
opts.config.max_concurrency,
|
||||
)
|
||||
.collect_links(inputs)
|
||||
.await;
|
||||
let requests = Collector::new(opts.config.base.clone(), opts.config.skip_missing)
|
||||
.collect_links(inputs)
|
||||
.await;
|
||||
|
||||
let client = client::create(&opts.config)?;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,21 +12,15 @@ use std::collections::HashSet;
|
|||
pub struct Collector {
|
||||
base: Option<Base>,
|
||||
skip_missing_inputs: bool,
|
||||
max_concurrency: usize,
|
||||
}
|
||||
|
||||
impl Collector {
|
||||
/// Create a new collector with an empty cache
|
||||
#[must_use]
|
||||
pub const fn new(
|
||||
base: Option<Base>,
|
||||
skip_missing_inputs: bool,
|
||||
max_concurrency: usize,
|
||||
) -> Self {
|
||||
pub const fn new(base: Option<Base>, skip_missing_inputs: bool) -> Self {
|
||||
Collector {
|
||||
base,
|
||||
skip_missing_inputs,
|
||||
max_concurrency,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +139,7 @@ mod test {
|
|||
},
|
||||
];
|
||||
|
||||
let responses = Collector::new(None, false, 8).collect_links(inputs).await;
|
||||
let responses = Collector::new(None, false).collect_links(inputs).await;
|
||||
let mut links: Vec<Uri> = responses.map(|r| r.unwrap().uri).collect().await;
|
||||
|
||||
let mut expected_links = vec![
|
||||
|
|
|
|||
Loading…
Reference in a new issue